function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VarunSforceVarunSforce 

Rollback data on approval request rejection

========================================================
Scenario:

We have a custom object with N number of fields, user can update any field and can submit record for approval. ( change the data and submit for approval.....)

Now if approver, approves the request then its Fine, if approver rejects the approval request then we want to rollback all the changed data.
========================================================

 

I would be writing APEX code to store previous state of data in one other object and when rollback is required will update record with this previous state.....

ANY INPUTS OR SUGGESTIONS.......

Ispita_NavatarIspita_Navatar

Can't you use "History Tracking " feature to get previous state of a particular field . I have read that there is a History Tracking Table which store as DataType Any the value of fields for which History Tracking is enabled.

Besides using a trigger to store the previous value s in a object too is agood approach, but what if new fields are added in Approval process , you will have to change your code , and if it is managed package you have to release a new version, so may be you would use a Setting table which will store the fields used in Approval process and you can formulate your DMLs dynamically after reading that table.

 

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.