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
VPVP 

Transactional capability?

Any suggestions about whether there exists transactional capability or how we can simulate it when we need an all or nothing behavior for a group of webservice calls?
DevAngelDevAngel
Hi VP,

Transactions are dependent on the ability to lock records and to restore fields that are currently not updateable. If you update 3 records, create 2 and delete 1 and then want to roll that back, you can definitely just delete the created record. For the update and delete you would need to save a copy of each record prior to the beginning of your transaction and on rollback re-create the deleted one and re-update with the original three. But looking at this more closely, you will see that durng the transaction, someone else may have updated one of the update records between the time you updated and the time you want to rollback. This would cause the other users changes to be overwritten. Also, the lastmodified date would not reflect the state of the records prior to the transaction. Re-creating a deleted record changes the created date, created by and last modified fields also.

So, the best approach to transactions is defined the dependencies that would cause the "transaction" to fail prior to the operation and, as best as you can, verify that the dependencies can be satisfied prior to executing the "transaction".