Salesforce Record-Triggered Flows
A smoke detector waits quietly until smoke appears, and the alarm starts without anyone pressing a button. A record-triggered flow behaves the same way. It watches an object, and the moment a record is created, updated, or deleted, the flow runs on its own. Admins use record-triggered flows to replace repetitive manual work with reliable automation.
What Triggers the Flow
Every record-triggered flow starts with three choices.
| Choice | Options |
|---|---|
| Object | Any standard or custom object, such as Opportunity |
| Trigger Event | A record is created, updated, created or updated, or deleted |
| Entry Conditions | Rules that decide whether the flow should run for that record |
Entry conditions save processing time. A flow that only matters for closed deals checks the Stage field first and stops quickly for every other record.
Before-Save and After-Save Flows
Salesforce offers two timing options. The choice affects speed and capability.
Before-Save Flow (Fast Field Updates)
The flow runs before Salesforce writes the record to the database. It changes fields on the triggering record directly, with no extra save step. Before-save flows run very fast and suit simple jobs such as stamping a date or formatting a phone number. Limits apply: the flow cannot create other records, send emails, or call actions.
After-Save Flow (Actions and Related Records)
The flow runs after Salesforce saves the record. The record now holds an Id, so the flow can create related records, update other objects, send emails, and launch subflows.
User clicks Save
|
v
+-------------------+
| Before-Save Flow | --> edits the same record
+-------------------+
|
v
Record saved to database
|
v
+-------------------+
| After-Save Flow | --> creates tasks, sends email,
+-------------------+ updates related records
Key Variables: $Record and $Record__Prior
The variable $Record holds the current values of the triggering record. The variable $Record__Prior holds the values from before the update. Comparing both variables lets the flow detect a change. A condition such as $Record.StageName not equal to $Record__Prior.StageName runs the flow only when the stage changes.
Build Example: Create a Follow-Up Task on Closed Won
A sales manager wants every won deal to trigger an onboarding task for the account owner.
- Open Setup, search for Flows, and click New Flow.
- Select Record-Triggered Flow.
- Choose the Opportunity object.
- Set the trigger to A record is created or updated.
- Add entry condition: Stage equals Closed Won.
- Choose Only when a record is updated to meet the condition requirements, so the flow runs once per win.
- Select Actions and Related Records as the optimisation.
- Add a Create Records element for a Task.
- Set Subject to Start onboarding, WhatId to $Record.Id, and OwnerId to $Record.OwnerId.
- Save, activate, and test with a sample deal.
Opportunity moves to Closed Won
|
v
Entry condition met?
| |
Yes No --> flow stops
|
v
Create Task: Start onboarding
|
v
Task appears on the owner's list
Scheduled Paths and Asynchronous Paths
After-save flows support extra paths. A scheduled path waits a set time before running, such as three days after the close date. An asynchronous path runs in a separate transaction, which suits slower work like callouts to outside systems. These paths keep the main save fast for users.
Order of Execution
Salesforce runs many automations in a fixed order: before-save flows, validation rules, the record save, after-save flows, and workflow-style actions. Knowing the order helps explain surprising results when several automations touch the same record. Use one flow per object and trigger event whenever possible to keep the order simple.
Best Practices
- Prefer before-save flows for same-record field changes.
- Write tight entry conditions to avoid needless runs.
- Keep Get Records and Update Records elements outside loops.
- Give every element a descriptive label and add a description to the flow.
- Add fault paths to elements that can fail.
- Test with a single record and a batch of 200 records from a data load.
Flows that follow these habits stay fast and easy to maintain as the business grows.
