Salesforce Order of Execution, Step by Step

By Prit Sakhvala, Salesforce Developer · Updated July 2026

When a record is saved, Salesforce runs a fixed sequence: system validation → before-save flows → before triggers → validation rules → duplicate rules → save (uncommitted) → after triggers → assignment, auto-response and workflow rules → escalation rules → after-save flows → entitlements → roll-up summaries → commit → post-commit logic (emails, async jobs). Knowing this order explains most "why did my field get overwritten?" mysteries.

The full sequence for a record save

  1. Load / initialize. The original record is loaded (or initialized for insert) and new field values are overwritten onto it.
  2. System validation. Required fields, field formats, maximum lengths, foreign keys. (For UI saves, layout-level rules run too.)
  3. Before-save record-triggered flows. Fast same-record updates, no extra save needed.
  4. Before triggers (before insert/update/delete).
  5. System validation again + custom validation rules. Your validation rules run after before triggers — so a before trigger can fix data that would otherwise fail validation.
  6. Duplicate rules. A blocking duplicate rule aborts the save here.
  7. Record saved to the database — but not committed. IDs exist now; nothing is permanent yet.
  8. After triggers (after insert/update/...).
  9. Assignment rules (Leads/Cases), then auto-response rules.
  10. Workflow rules. ⚠️ If a workflow field update changes the record, before and after update triggers fire one more time (only once more — not infinitely).
  11. Escalation rules (Cases).
  12. After-save record-triggered flows (and legacy processes). Updates to the same record here re-enter the save sequence.
  13. Entitlement rules.
  14. Roll-up summaries & cross-object formulas. Parent (and grandparent) records recalculate and save — running their triggers.
  15. Criteria-based sharing evaluation.
  16. Commit. Everything above succeeds or the whole transaction rolls back.
  17. Post-commit logic. Emails send, and queued async work (future methods, queueables) is enqueued to run in separate transactions.

This is the standard sequence as documented in the official Salesforce order-of-execution reference — worth bookmarking, since Salesforce occasionally adjusts details between releases.

The consequences that bite people

Seeing the real order in your own org

The list above is the theory. Your org's reality — which of your flows, triggers and rules ran, in which order, for a specific save — is written in the debug log as a sequence of CODE_UNIT_STARTED, FLOW_START_INTERVIEW, VALIDATION_RULE and WF_RULE_* events. Reading that interleaving by hand works (see how to read Apex debug logs) but is slow.

This is ForceLens's signature feature: its Order of Execution view reconstructs the diagram from your actual log — every trigger, flow, validation and workflow in the order they really fired, including re-entries. The whiteboard drawing, generated from production truth.

ForceLens Order of Execution view reconstructing a Salesforce record save from a debug log

Frequently asked questions

What is the Salesforce order of execution?

The fixed sequence of steps Salesforce runs on every record save — from system validation and before-save flows through triggers, rules, after-save flows and roll-ups to the final commit and post-commit logic.

Do before-save flows run before or after triggers?

Before — the start of the sequence is: system validation → before-save flows → before triggers → validation rules.

Why does my trigger fire twice on one save?

A workflow field update or a same-record after-save flow update re-saved the record, re-firing update triggers. The debug log shows the exact re-entry.

How can I see the order of execution for a real save?

Capture a debug log of the save and follow the event sequence — or open it in ForceLens, which reconstructs the order visually.

See your org's real execution order

Capture any save with ForceLens and get the order of execution as a diagram — triggers, flows, validation, re-entries and all. Free and local.

Add ForceLens to Chrome — Free