Posted: 25 Oct 2016 8:34 EDT Last activity: 3 Nov 2016 9:15 EDT
Declare OnChange and Declare Triger
I was going through the "Declarative Processing" part of the course. There was a description about Declare OnChange and Declare Trigger. It states "Declare OnChange can track several properties that have been saved as part of the case" and for Declare Trigger an example is given that states "there is a scenario that the audit trail must contain information about the different values stored as part of discount. Whenever the values in the discount change, it causes the trigger to fire the standard activity which writes an entry to the audit trail".
I think that the description for both these rules are swaped/interchanged. For the example given for Declare Trigger, the changed values of the properties will not be captured unless the instance is saved. To track the change in values in audit trail- Using Declare On change should be the preffered approach. Kindly help if I missed something. Thank You.
Declare onchange rule contain a set of property, and an activity which will fire if the value for any of those property changes during your flow executation or on screen by user action. But it is not necessary that the values is set of final values which is going to be save in DB. (value of property changed and you want to track it, not necessary to save those value to db)
On other hand Declare tigger comes into picture when value is saved in DB. In case the value is save to DB the activity fires.
I concurr with Hareesh. The statements you referred are correct. Declare Trigger works on Commit. So, it has the opportunity to retrieve value already saved in database and can help in Field Level Audit. On the other side, Declare Onchange is executed on a value change in clipboard. Every change in Clipboard would not go to Database. There can be multiple updates to a property before a Commit occurs.