You need to sign in to do that
Don't have an account?
rtvkgnde
prevent new values from record save
I have a contract object, on which If any changes are made and submit the record, the new values doesn't needs to be saved on the Contract object until the changes are approved via approval process. Once, the record is approved by the user!! It's when the changes needs to be updated to the Contract record. How can I achieve this?
All Answers
If you create a custom field on your object, say, isApproved__c (checkbox, default to false), your approval process could update that field when the record is approved.
From there, you can wrap your desired trigger code in an if(record.isApproved__c && !trigger.oldMap.get(record.Id).isApproved__c) block to prevent that specific code from being run until isApproved__c is flipped from false to true (and you want to do the comparison against the old value as well, lest your code execute on every single trigger firing after it is approved).
Also check below threads for similar discussion.
http://www.forcetree.com/2009/06/how-to-check-whether-record-has-been.html
https://developer.salesforce.com/forums/?id=906F0000000949wIAA
https://salesforce.stackexchange.com/questions/143889/how-can-a-trigger-be-written-so-that-it-fires-when-a-record-is-approved/143895
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
Best Regards
Sandhya