Best Practices - Using Snapshots
The purpose of this document is to provide best practices when using snapshots.
In a rule associated with the property of a class used in CRUD management, you can get access to the property value with this.PROPERTY
.
Similarly, this.snapshot.PROPERTY
gives you access to the previous value of the property.
Using a snapshot makes it easy to handle update controls.
Example 1: During a control, using a snapshot allows you to compare the original value and the current value.
# Let's compare the current value and its snapshot:If this.snapshot.PROPERTY<>this.PROPERTY# The current property has been modifiedEndif
Example 2: As propagation rules are only triggered after a successful modification, comparing the snapshot and the current values can be useful. After the first modification, both values are different because the propagation rule was triggered. However, after the second modification, they could be the same if the user reverses the modification.