Sub topic 5
Flow Builder essentials for migrators
This chapter assumes you can navigate Setup, know what objects, fields, and records are, can read a Workflow Rule or Process Builder process, and can write basic formulas. You need a sandbox or Developer Edition org to follow along. The goal is to give you the Flow vocabulary you will use in every later chapter, not to teach all of Flow.
Flow types you will meet
Flow Builder is the canvas where you build flows. Salesforce offers several flow types, and migration work uses mostly one of them.
| Flow type | Starts when | Migration use |
|---|---|---|
| Record-Triggered Flow | A record is created, updated, or deleted | Replaces Workflow Rules and Process Builder |
| Schedule-Triggered Flow | A set time, for a batch of records | Occasional replacement for scheduled actions |
| Screen Flow | A user opens it | Rarely part of a migration |
| Autolaunched Flow | Another flow, Apex, or a process calls it | Reusable logic and subflows |
The next chapter covers record-triggered flows in detail. Here you learn the building blocks they share.
Building blocks
A flow is a set of elements joined by connectors. Three groups matter most.
- Logic elements decide what happens. A Decision element routes records down outcomes, much like a Process Builder criteria node. An Assignment element sets values in memory. A Loop element repeats steps for each item in a collection.
- Data elements work with records. Get Records queries them. Create Records, Update Records, and Delete Records change them.
- Action elements do work outside the database. Examples are Send Email, Post to Chatter, and calling an Apex action.
Variables and resources
Flows keep data in resources. A variable holds one value. A record variable holds one record. A collection variable holds a list of values or records. A formula resource calculates a value each time the flow reads it.
Record-triggered flows provide a special resource, {!$Record}, which is the record that started the flow. In an update-triggered flow, {!$Record__Prior} holds the values before the change. You will use $Record__Prior to replace ISCHANGED and PRIORVALUE.
Formulas in flows
Flow formulas use the same functions you know from Workflow Rules, with some differences. Picklists are the most common trap. Workflow Rules use ISPICKVAL, while flows use TEXT().
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)Also note that flow formulas reference resources with curly braces and an exclamation mark, such as {!$Record.Amount}.
Working in the canvas
Use Debug in Flow Builder to run a flow against a real record and see each element's result. A flow saves as a version. Only one version is active, and activating a new one deactivates the old. This makes rollback simple: reactivate the earlier version.
Common errors
- Using
ISPICKVALin a flow formula. It fails to save. UseTEXT(). - Forgetting that a flow is inactive until you activate it. A saved draft does nothing.
- Treating a variable as if it persists. Variables exist only during one flow run.
Exercise
A Workflow Rule formula uses ISPICKVAL(Status, "Open") and ISCHANGED(Status). How do you write both conditions in a record-triggered flow?
Show answer
Use TEXT({!$Record.Status}) = "Open" for the picklist check. Replace ISCHANGED(Status) with {!$Record.Status} <> {!$Record__Prior.Status}, which works in an update-triggered flow.