Is it possible to make the update method fail if e.g. the modification date is different than X in Salesforce API?
The task is to update a field of an object in Sfdc only if the record hasn’t changed since I last got it from Sfdc.
Even if I query an object in Sfdc and check if it has been modified and it hasn’t and then I issue an update there is still a window where the record could change between my check and the update command. This is an old concurrency sync problem – Does Sfdc has any mechanisms to help dealing with it?
Thanks in advance,
Tymek
I’d recommend looking at the Salesforce Order of Execution before deciding on a solution.
You could try a Validation Rule (with the ISCHANGED function) to check whether a field has changed or a Trigger (on Update using trigger.new and trigger.old to compare values).
Check out this document on Validation Rules and this document for Triggers for additional reference.