Section 8 · Process Automation · 20% of exam
8.2 Order of execution, recursion, and automation interaction
Exam objective
Understand implications of Salesforce order of execution when using automation tools. A record save can trigger a sequence of platform actions and automation. The order includes validation and system processing, before-save flows, triggers, duplicate checks, after-save flows, assignment or escalation behavior, workflow and approval-related processing, and other platform steps, with details depending on transaction type and current Salesforce behavior. The important administrative lesson is that multiple automations can act on the same record in one transaction, and later steps may cause the record to be evaluated again. Consult the current Salesforce order-of-execution reference for exact sequencing.
Before-save record-triggered flows are generally appropriate for fast updates to fields on the record that initiated the transaction. They avoid a separate update operation for those fields. After-save flows run after the record is saved and are appropriate for related-record updates, actions, and other post-save work. If an after-save flow updates the same record, it can cause another save cycle and potentially re-enter automation. Use entry criteria, prior-value comparisons, and deliberate update design to avoid repeated work.
A common recursion pattern occurs when automation updates a record in a way that retriggers the same flow or another automation. A robust design checks whether the business-relevant value changed and only acts when the record enters the intended state. Avoid relying on a single static 'run once' assumption when bulk operations, retries, or related automation can occur. Keep idempotency in mind: running the same action twice should not create duplicate tasks, emails, or child records. Use unique keys or existence checks when repeated execution is possible. Order of execution matters for validation and formulas. A value may be set before or after a particular rule evaluates, and a workflow or flow update can cause re-evaluation under defined circumstances. When a user sees a validation error despite a flow setting a field, determine whether the flow runs before the validation and whether the field value is actually available at that point. Do not infer sequence from the order of elements on the Flow canvas; transaction timing is a platform behavior.
Automation also interacts with security context. A system-context flow can update records a user could not edit directly, while a user-context flow may fail when the user lacks access. Bulk operations can invoke automation for many records and expose limits or locking contention. Design for bulk-safe operations, avoid unnecessary per-record queries or repeated updates, and test with batches and concurrent users where practical. A solution that works for one screen edit may fail during a data load.
When diagnosing unexpected results, build a timeline of the transaction: initiating action, flow interviews, trigger events, field updates, validation, asynchronous paths, and external actions. Use debug logs and Flow error emails to verify the actual path. Compare old and new field values and inspect entry conditions. Temporarily deactivating automation can help isolate a cause only in a controlled test environment; in production it can create inconsistent records or bypass controls.
Exam focus: choose before-save flow for same-record field updates when appropriate, after-save flow for related records and actions, and understand how updates can retrigger automation. Identify prior-value conditions and idempotency as recursion controls. Consider validation timing, bulk behavior, and user versus system context. Use the official order-of-execution reference for sequence-specific details rather than memorizing an outdated diagram.
A flow that creates a child record on every update can produce duplicates during re-entry. Guard the business transition and make repeated processing safe.
The transaction boundary matters when external side effects occur. An action that sends an email or calls an external service may not be reversible if a later step fails. Prefer to keep the core data transaction consistent, defer work that can happen asynchronously when the feature supports it, and use idempotency keys for retryable integrations. Review duplicate rules, assignment behavior, and approval locks as part of the sequence. When platform behavior is uncertain, reproduce it in a sandbox and consult the current official order-of-execution documentation.
Practical scenario
A case flow should create one escalation task only when a case first enters Escalated status. Use an entry condition that detects the status transition, rather than simply checking that the current status is Escalated. Ensure retries do not create another task by checking for an existing open escalation task or using a stable reference key. Test initial creation, unrelated edits, escalation, reopening, and re-escalation.
Extra concept
Asynchronous paths run outside the immediate transaction in supported scenarios and can change when data becomes visible or failures are reported. Use them for work that can safely happen later, and design for the record changing between the initial event and the delayed action.
Key takeaways
- Use transition-aware entry criteria to prevent repeated processing.
- Design actions to be idempotent and bulk-safe.
- Consult the current order-of-execution guide for transaction-specific sequencing.
- Official references: https://help.salesforce.com/s/articleView?id=005298969&language=en_US&type=1 https://developer.salesforce.com/docs/platform/lwc/guide/order_of_execution.html https://help.salesforce.com/s/articleView?id=sf.flow.htm&type=5 https://help.salesforce.com/s/articleView?id=sf.workflow_rules.htm&type=5
