Triggers and Order of Execution
So, Friends, I am here to share about Order of Execution in Salesforce. When we Create/Update/Insert/Delete a record, so many actions will take part of it. Below I will list out the executions in order.
1) Firstly Salesforce Loads the original record from the database or initializes the record for an upsert statement.
2) Loads the new record field values and overwrite the old values.
3) If you are using Standard UI, Standard validations will take part now.
For instance – Valid field format, Maximum length of the field and etc…
4) Executes all Before triggers.
5) Executes all Custom validations.
6) Executes Duplicate Rules.
7) Salesforce Saves the record to the database. But it doesn’t commit yet.
8) Executes all After trigger.
9) Executes Assignment Rules.
10) Executes Auto-Response Rules.
11) Executes our favorite Workflow Rules.
12) If there are any workflow updates, update the record again.
13) The records which are updated with workflow, field updates, fires before update triggers and after update trigger one more time (only one more time), in addition to standard validations. Custom validation rules and duplicate rules are not run again.
14) Executes Processes.
15) Executes Escalation Rules.
16) Executes Entitlement Rules.
17) If the record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record.
18) If the parent record is updated, and a grandparent record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the grandparent record.
19) Executes Criteria Based Sharing evaluation.
20) Commits all DML operations to the database.
21) Executes post-commit logic. For instances – Sending.
Stay tuned to salesforceupdates.com for more updates.
Thank you so much for reading my post. Feel free to ask doubts/Queries in the comment section below, and I’ll come again with an interesting topic about Salesforce So Please Share, Subscribe to our blog for the latest update.