Sub topic 6
Record-triggered flows: the replacement for both tools
This chapter assumes you can read a Workflow Rule or Process Builder process, write basic formulas, and have a sandbox or Developer Edition org to try things in. It explains how a record-triggered flow is built so you can map old automation onto it in later chapters.
What a record-triggered flow is
A record-triggered flow runs automatically when a record is created, updated, or deleted. One flow type replaces both older tools. It also covers things that used to need Apex triggers.
Every record-triggered flow is defined by three settings.
- Object. The one object whose records start the flow.
- Trigger. Create, update, create or update, or delete.
- Optimization. Fast Field Updates (before save), or Actions and Related Records (after save). The next chapter covers this choice.
You can also set entry conditions that decide which records run the flow. The chapter on entry conditions covers them in detail.
How the old tools map to flows
| Old tool concept | Record-triggered flow equivalent |
|---|---|
| Workflow Rule evaluation criteria | Trigger setting plus entry conditions |
| Process Builder criteria node | Entry condition or a Decision element |
| Immediate actions | Elements on the main path |
| Time-dependent or scheduled actions | Scheduled paths |
A Workflow Rule has one criteria set and a list of actions. A Process Builder process can have several criteria nodes, each with its own actions. In a flow, the entry conditions work like the rule's criteria. Decision elements inside the flow replace extra criteria nodes.
The shape of a flow
The main path is the "immediate actions" part of the old tools. A scheduled path waits for a time you define, such as 7 days after Close Date, and then runs its own elements.
Variables you will use
Two global variables matter from the start.
{!$Record}holds the record that started the flow, with its new values.{!$Record__Prior}holds the values from before the update. It is available only in flows that run on update. It is the flow answer toPRIORVALUEandISCHANGEDin older tools.
In a before-save flow, you change $Record fields directly, and Salesforce saves them with the record. You do not use an Update Records element for this.
Common mistakes
- Picking the wrong trigger. A Workflow Rule set to "created" only should not become "created or updated" in the flow. You will get extra runs.
- Building one flow per old rule without a plan. This leaves many flows on one object with an unclear order. The consolidation chapter covers this.
- Expecting a flow to start from the Flow list. Record-triggered flows are not launched by a user. You activate them, and a save starts them.
Exercise
A Process Builder process has two criteria nodes on Opportunity. The first updates a field when Stage is Closed Won, and the second creates a Task when Amount is over 100,000. Name two ways to represent this in a record-triggered flow.
Show answer
Build one flow on Opportunity with a Decision element that has an outcome for each condition, and place the field update and the Task creation on the matching outcomes. Alternatively, build two flows, each with entry conditions that match one node. The first approach keeps logic for the object in one place. The second is simpler to read but adds to the number of flows you must order and test.