Salesforce Menu

Salesforce Order Of Execution

The order of execution is salesforce refers to the order in which the automations/triggers etc. are called when we insert or update a new record into the database.

Here is what the order of execution is:
  1. Original record loaded from the database or initializes the record for an upsert statement.
  2. A new record field value is loaded and overwrites the old values. If the record was saved from the UI, performs field length and type validations.
  3. Executes flows that make before-save updates.
  4. All before triggers executed.
  5. System validation steps like verifying all required fields run again, and run any user-defined validation rules.
  6. Executes duplicate rules. If a duplicate is identified, the record is not saved and no further steps like after triggers and workflow rules are taken.
  7. Saves the record into database, but doesn’t commit yet.
  8. All after triggers are executed.
  9. All assignment rules are executed.
  10. Auto-response rules are executed.
  11. Workflow rules executed.
  12. If there are workflow field updates, update process applies again on record.
  13. If the record is updated with workflow field update than before update triggers and after update triggers are fired once more in addition to standard validations. Functionalities which do not run once again are: Custom validation rules, flows, duplicate rules, processes, and escalation rules.
  14. All Processes and flows which are launched via processes and flow trigger workflow actions are executed.
  15. When a process or flow executes a DML operation, the affected record would have the save procedure again.
  16. Escalation rules are executed.
  17. Entitlement rules are executed.
  18. If the record has a roll-up summary or record is part of cross-object workflow, calculations performed and the roll-up summary field in the parent record is updated than Parent record at the same time have the save procedure.
  19. If parent record is updated, and grandparent record contains a roll-up summary or is part of a cross-object workflow, calculations performed and roll-up summary in the grandparent record is updated. Grandparent record have the save procedure.
  20. Criteria Based Sharing rules are executed.
  21. All DML operations committed to database.
  22. Post-commit logic, such as sending email etc is executed.
Subscribe Now