Salesforce rule and trigger execution order

Posted on

The following is the order salesforce logic is applied to a record.

  1. Old record loaded from database (or initialized for new inserts)
  2. New record values overwrite old values
  3. System Validation Rules
  4. All Apex before triggers (EE / UE only)
  5. Custom Validation Rules
  6. Record saved to database (but not committed)
  7. Record reloaded from database
  8. All Apex after triggers (EE / UE only)
  9. Assignment rules
  10. Auto-response rules
  11. Workflow rules
  12. Escalation rules
  13. Parent Rollup Summary Formula value updated (if present)
  14. Database commit
  15. Post-commit logic (sending email)

Additional notes:

There is no way to control the order of execution within each group above.

Workflow field updates that run based on an approval process or time-dependent action do not trigger any rules.

Formula fields do not execute in this way. They calculate and display their results real-time whenever the field is accessed in any way. So for example if a Workflow Rule uses a Formula Field in its criteria or formula, the formula field is evaluated when the Workflow Rule criteria is checked.

One response »

Leave a comment