Salesforce Fact #73 | Save your work

We can use savepoints to return to a previous state in the transaction. 

In this example, we are inserting list of Accounts and Contacts in the try block. For some reason if contact insert fails, we want to rollback the account inserts also. For this we can use savepoint.

Attached is the screenshot.


Comments

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

Salesforce Fact #457 | Get current user role name in flow