Skip to main content

SF-0113 · Concept · Hard

What is the order in which salesforce processes rules?

✓ Verified by Vikas Singhal · Last reviewed 5/17/2026 · Updated for Spring '26

The Salesforce order of execution is the canonical answer to “what happens when a record is saved?” Every senior interview eventually circles back to this list — it’s the single most-asked deep question on the platform.

The order, in 2026

  1. Load the original record from the database (or initialize a new one)
  2. Load new field values from the request and overlay them
  3. System validation — required fields, max lengths, foreign keys
  4. Apex before triggers execute
  5. Custom validation rules evaluate (and run system validation again on any layout-based required fields)
  6. Duplicate rules run; if a record is blocked, the save aborts
  7. The record is saved to the database — but not yet committed
  8. Apex after triggers execute
  9. Assignment rules (Lead/Case) run
  10. Auto-response rules (Lead/Case) run
  11. Workflow rules evaluate and fire
    • If field updates fire, before/after triggers run AGAIN on those updates (once per workflow field-update cascade)
  12. Processes and flows (Process Builder, after-save Record-Triggered Flows) run
  13. Escalation rules (Case) run
  14. Entitlement rules run
  15. Roll-up summary fields recalculate on parent records
  16. Cross-object workflow on parents fires if applicable
  17. Criteria-based sharing recalculation runs
  18. DML commit — the transaction is finalised
  19. Post-commit logic runs: email send, async Apex (@future, Queueable, Batch finishers), Lightning notifications

Why this matters for design

  • Validation runs before triggers — so trigger-set fields don’t help validation pass
  • Workflow runs after triggers — your trigger sees the user’s edits, but not workflow field updates
  • Flows can run before triggers — before-save Record-Triggered Flows execute around the same time as before-triggers (since 2021)
  • Roll-ups recalc last — your trigger reads the old roll-up value, not the post-save one

The classic interview trap

“What’s the order of execution?” gets asked at every level. A common follow-up: “If I update a field in a before trigger, and a workflow field update sets it to something else, which value wins?”

Answer: The workflow value wins, because workflow runs after before-triggers. But that workflow field update re-fires before/after triggers on the record, giving them a second chance.

Where after-save flows fit

Salesforce’s modern guidance is to use before-save Record-Triggered Flow for same-record updates instead of workflow field updates. Before-save flows run at roughly the same point as before-triggers (slightly before, in step 4ish) and don’t require an extra save like workflow field updates do — they’re orders of magnitude faster at scale.

What interviewers want

  • The list in order, not necessarily verbatim but with the key stations: validation, before trigger, after trigger, workflow, flow, commit, async
  • The detail that workflow field updates re-fire triggers
  • Awareness of where before-save flows sit (essentially with before-triggers)

Verified against: Apex Developer Guide — Triggers and Order of Execution. Last reviewed 2026-05-17 for Spring ‘26 release.