Transaction Control | Database - setSavepoint and rollback

Transaction Control | Database - setSavepoint and rollback

Below is the scenario where the requirement is whenever a record of object A is inserted and its Id to be used on a lookup field of another record of object B which is to be inserted later.
If the record of object B does not matches the criteria after insert of object A record, then the inserted record of object A should be reverted and object B record should not be committed to the database.

To achieve this we are using transaction control here via database methods setSavepoint and rollback.




For further details, click here for the reference article.

Please share your feedback or comments or queries related to this post, on below comment section.

Hashtags - #sfdcsasid #sfdc #sasid #salesforce #transactioncontrol #database #setSavepoint #rollback

😊



Comments