Salesforce Triggers and Order of Execution

  1. Loads the original record from the database or initializes the record for an upsert statement.
  2. Loads the new record field values from the request and overwrites the old values.
  3. Executes record-triggered flows that are configured to run before the record is saved.
  4. Executes all before triggers.
  5. Runs most system validation and runs any custom validation rules.
  6. Executes duplicate rules.
  7. Saves the record to the database, but doesn’t commit yet.
  8. Executes all after triggers.
  9. Executes assignment rules.
  10. Executes auto-response rules.
  11. Executes workflow rules. If there are workflow field updates:
  12. Executes escalation rules.
  13. Executes these Salesforce Flow automations, record-triggered flows
  14. Executes entitlement rules.
  15. If the record contains a roll-up summary field calculations
  16. Executes Criteria Based Sharing evaluation.
  17. Commits all DML operations to the database.
  18. After the changes are committed to the database, executes post-commit logic. Like sending email etc
Share your love:

Leave a Reply

Your email address will not be published. Required fields are marked *