Sub topic 8
Translating criteria and run frequency into entry conditions
This chapter assumes you can read a Workflow Rule or a Process Builder process, write basic formulas, and open Flow Builder in a sandbox. It covers one job: turning the "when does this run" part of an old automation into the entry conditions of a record-triggered flow. Actions come in a later chapter.
What you are translating
A Workflow Rule or a Process Builder process decides whether to run based on three things.
- The object and the event: created, or created and edited.
- The criteria: field conditions or a formula.
- The run frequency: how often the automation may fire for the same record.
A record-triggered flow expresses the same three things in its Start element:
| Old concept | Flow Start element setting |
|---|---|
| Object | Object |
| Evaluate the rule when a record is created | Trigger the flow when: A record is created |
| Evaluate the rule when a record is created, and every time it's edited | Trigger the flow when: A record is created or updated |
| Criteria (filters) | Condition Requirements: All Conditions Are Met (AND) |
| Criteria (any of) | Condition Requirements: Any Condition Is Met (OR) |
| Criteria (custom logic) | Condition Requirements: Custom Condition Logic Is Met |
| Criteria (formula) | Condition Requirements: Formula Evaluates to True |
| Run frequency | Run the flow: Only when a record is updated to meet the condition requirements, or Every time a record is updated and meets the condition requirements |
Choosing the trigger event
Workflow Rules offer three evaluation options. Two of them map directly to flow triggers, and the third needs care.
- Created maps to "A record is created".
- Created, and every time it's edited maps to "A record is created or updated", with the run setting "Every time a record is updated and meets the condition requirements".
- Created, and any time it's edited to subsequently meet criteria maps to "A record is created or updated", with the run setting "Only when a record is updated to meet the condition requirements".
Process Builder has two triggers: "only when a record is created" and "when a record is created or edited". These map to the same two Flow options. Its per-criteria-node setting "Do you want to execute the actions only when specified changes are made to the record?" is the Process Builder version of run frequency, and it is covered below.
Translating simple criteria
Filter-based criteria translate almost one to one. Each filter row becomes a row in the Start element's condition list.
- Field, operator, and value carry over directly.
- "Filter logic" such as
1 AND (2 OR 3)becomes Custom Condition Logic. - Conditions that compare a field to another field or use functions need a formula instead.
Condition rows in a flow compare against a constant, a global constant, or a resource. When the old criteria compared two fields on the record, use the formula option.
Translating formula criteria
Formula criteria need the most attention, because Workflow Rule formulas and flow formulas are close but not identical. The known differences are listed here.
| Workflow Rule formula | Flow formula |
|---|---|
| `ISPICKVAL(Field, "Value")` | `TEXT({!$Record.Field}) = "Value"` |
| `ISCHANGED(Field)` | `{!$Record.Field} <> {!$Record__Prior.Field}` |
| `ISNEW()` | `ISNEW()` works in the flow formula, but a "created" trigger is clearer |
| `PRIORVALUE(Field)` | `{!$Record__Prior.Field}` |
| `Field` | `{!$Record.Field}` |
Here is the same condition written both ways:
Workflow Rule formula:
AND(ISPICKVAL(StageName, "Closed Won"), Amount > 100000)
Flow entry condition (Formula Evaluates to True):
AND(TEXT({!$Record.StageName}) = "Closed Won", {!$Record.Amount} > 100000)
Workflow ISCHANGED(StageName) in a flow:
{!$Record.StageName} <> {!$Record__Prior.StageName}Points to remember:
- Every field reference in a flow formula is wrapped in
{!$Record.…}. Forgetting the prefix is the most common error. $Record__Priorexists only when the flow triggers on update or on create-or-update. On a create, the prior values are empty, so a comparison like$Record.Field <> $Record__Prior.Fieldcan evaluate true for any non-blank value. That is usually whatISCHANGEDdoes on a new record too, but test it.- A comparison with a blank field can behave unexpectedly. Wrap nullable fields in
ISBLANK()checks where the old rule relied on blank handling.
Run frequency: the part people miss
Run frequency is where most duplicate or missing firing comes from, so treat it as a first-class part of the translation.
A Workflow Rule that evaluates on "created, and every time it's edited" fires on every save in which the criteria are true. A rule that evaluates "any time it's edited to subsequently meet criteria" fires only when the record moves from not meeting the criteria to meeting them.
In a flow, these two behaviors are chosen by the run setting on the Start element:
- Every time a record is updated and meets the condition requirements. The flow runs on each save where the criteria are true, even if nothing relevant changed.
- Only when a record is updated to meet the condition requirements. The flow runs only when the record did not meet the criteria before the save and does meet them after.
The second option is the safer default for most migrations. It prevents a flow from firing again whenever an unrelated field changes.
Process Builder's "only when specified changes are made"
In Process Builder, each criteria node has a checkbox that limits the node to run only when fields used in its criteria changed. Process Builder also has an "Evaluate the next criteria if this one is true" option. Translate them as follows:
- If the checkbox is not selected, the node ran on every save where the criteria were true. Use "Every time a record is updated and meets the condition requirements".
- If the checkbox is selected, use "Only when a record is updated to meet the condition requirements". If the criteria test several fields, check that the old behavior ("any of these fields changed") matches the new one ("the record newly meets all the criteria"). They are not always the same, so confirm with a test.
- If the old node used
ISCHANGEDin a formula, keep that logic with$Record__Priorin a formula entry condition and choose the "Every time" option, so the formula alone controls firing.
Multiple criteria nodes
A Process Builder process with several criteria nodes does not map to a single set of entry conditions. Each node has its own criteria and its own actions. You have these options:
- Create one flow whose Start element holds the shared condition, then use a Decision element with an outcome per node.
- Create one flow per node, if the nodes are independent and you prefer small flows.
When a node has "Stop the process" set instead of "Evaluate the next criteria", the Decision outcomes must be mutually exclusive in the same order. When it evaluates the next criteria, later nodes still run, so a Decision with a single path will not reproduce that. Put the actions of each matching node on separate sequential paths, or use separate flows.
PlaceholderA decision flow for the translation
Worked example
Suppose a Workflow Rule on Opportunity has this setup:
- Evaluation: Created, and any time it's edited to subsequently meet criteria.
- Formula:
AND(ISPICKVAL(StageName, "Closed Won"), Amount > 100000). - Action: create a follow-up task for the owner.
The flow's Start element would be:
- Object: Opportunity.
- Trigger: A record is created or updated.
- Condition Requirements: Formula Evaluates to True, with
AND(TEXT({!$Record.StageName}) = "Closed Won", {!$Record.Amount} > 100000). - Run the flow: Only when a record is updated to meet the condition requirements.
With this setup, the flow runs once when an opportunity reaches Closed Won above the amount. It does not run again when a user edits the description of the same opportunity.
Compare that with choosing "Every time a record is updated and meets the condition requirements". Each edit to a Closed Won opportunity over 100,000 would create another task. This is the duplicate-firing problem that this chapter exists to prevent.
Edge cases and gotchas
- Entry conditions versus a Decision element. Conditions on the Start element stop the flow before it runs, which saves resources and keeps debug logs short. A Decision element inside the flow only routes after the flow has started. Put the main criteria in the Start element and use Decisions for branching.
- Formulas with cross-object fields.
{!$Record.Account.Industry}is available in flow formulas, but a change to the Account does not trigger an Opportunity flow. The old Workflow Rule behaved the same way, so this is not a regression, but check that nobody relied on it. - Process Builder updates that re-trigger. A Process Builder process could be set to re-evaluate the record after its own field update. In a flow, a record-triggered flow does not re-run itself on its own update, so logic that depended on that chain may need an explicit design. The bulk and recursion chapter covers this.
- Formula length. Flow Start formulas are subject to formula compile limits, so move long logic into a formula resource or a Decision element.
- Time zones and dates.
TODAY()in a flow formula uses the running user's time zone, as in a Workflow Rule. Dates are rarely the source of a bug, but check any rule that compares a date toTODAY().
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Flow saves but never fires | Picklist compared without `TEXT()` or a typo in the API value | Use `TEXT({!$Record.Field}) = "Value"` and check the value's API name |
| Flow fires on every edit | Run setting is "Every time" | Switch to "Only when a record is updated to meet the condition requirements" |
| Flow fires on create when it should not | Trigger is create-or-update, and the criteria are true at creation | Choose "A record is updated", or add a condition on `$Record__Prior` |
| Formula error on save | Missing `{!$Record.` prefix or an unsupported function | Add the prefix and check the function against the flow formula list |
| `$Record__Prior` not available | The trigger is create-only | Change the trigger or remove the prior-value comparison |
Exercise
A Process Builder criteria node has the formula ISCHANGED([Case].Status), and the "only when specified changes are made" box is not selected. Write the Start element settings for the replacement flow, including the entry condition formula and run frequency, and explain why.
Show answer
Trigger: A record is created or updated (or only updated, if the process was not meant to fire on create). Condition Requirements: Formula Evaluates to True, with {!$Record.Status} <> {!$Record__Prior.Status}. Run the flow: Every time a record is updated and meets the condition requirements. The formula itself detects the change, so the run setting must not add a second "newly meets criteria" rule on top of it. Choosing "Only when a record is updated to meet the condition requirements" would also suppress a second Status change while the formula stays true, which the old process did not do.
Exercise
A Workflow Rule on Opportunity is set to "Created, and any time it's edited to subsequently meet criteria" with the formula AND(ISPICKVAL(StageName, "Closed Won"), Amount > 100000). Which two Start element settings preserve this behavior, and what does the flow do when a user edits only the Description of an opportunity that is already Closed Won with Amount 150000?
Show answer
Use Condition Requirements: Formula Evaluates to True with AND(TEXT({!$Record.StageName}) = "Closed Won", {!$Record.Amount} > 100000), and set Run the flow to "Only when a record is updated to meet the condition requirements". Because the record already met the criteria before the edit, the flow does not run when only the Description changes.