Skip to content
Tutorials Center
My learning

Topics

Lesson 19 of 36 ยท Automation with Flow

Flow Builder Overview: Flow Types and Elements

Learn what Salesforce Flow is, the main flow types, the elements on the canvas, and how to choose a flow type, with a JavaScript stand-in that simulates a tiny flow engine.

Flow is the tool Salesforce administrators use to automate business processes without writing code. A flow is a diagram of steps: look up some records, make a decision, change a field, send an email, or ask a user for input. You build it on a canvas called Flow Builder (Setup, then Process Automation, then Flows, then New Flow). Flow replaced the older Workflow Rules and Process Builder, which Salesforce has retired, so every new automation you create today is a flow.

You cannot run Salesforce on this site, so this chapter describes the real menus and behavior in words, and each lesson adds a small JavaScript stand-in that teaches the same idea. The stand-ins are labelled and are not Salesforce code. Nothing on this page shows real Salesforce output.

The flow types

When you create a flow, the first choice is its type. The type decides what starts it.

Flow type What starts it Typical use
Record-Triggered Flow A record is created, updated or deleted Set a field, create a task, notify an owner
Screen Flow A user (button, tab, Lightning page, utility bar) Guided data entry, wizards, scripted calls
Schedule-Triggered Flow A schedule (once, daily, weekly) Nightly cleanup, reminders for stale records
Platform Event-Triggered Flow A platform event message arrives Reacting to events from other systems
Autolaunched Flow (no trigger) Another flow, Apex, a button action or an API call Reusable logic called from elsewhere (a subflow)
Flow Orchestration A longer process with stages and several people Onboarding with hand-offs between teams

A good habit: ask first "what event should start this?" The answer almost always points to one type.

flowchart TD
  Q["What starts the automation?"] -->|"A record changes"| R["Record-Triggered Flow"]
  Q -->|"A person clicks or opens something"| S["Screen Flow"]
  Q -->|"A clock"| T["Schedule-Triggered Flow"]
  Q -->|"Another process calls it"| A["Autolaunched Flow"]
  Q -->|"An external event message"| P["Platform Event-Triggered Flow"]

Picking a flow type by its start condition.

The canvas and its elements

Flow Builder has two canvas modes: Auto-Layout (elements snap into a tidy vertical layout; the default) and Free-Form (you place elements anywhere). Both create the same flow. Click the plus sign on a connector to add an element. Elements fall into three groups.

Interaction elements talk to users: Screen (a page with fields and text), Action (send an email, post to Chatter, submit for approval, call an invocable Apex action) and Subflow (call another flow).

Logic elements control the path: Decision (branch on conditions), Assignment (set variable values), Loop (repeat for each item in a collection), Collection Sort, Collection Filter, Transform and Wait (pause until a time or event).

Data elements work with records: Get Records, Create Records, Update Records and Delete Records.

Every element has a label and an API name. Use clear labels (for example, "Get Open Cases for Account") because you will read the flow again months later, and error emails mention elements by label.

Resources: where flow data lives

Flows keep their data in resources. You create them from the Manager tab (the toolbox on the left).

  • Variable: holds one value (text, number, boolean, date, a record). Mark it Available for input or Available for output to pass data in or out of a flow.
  • Collection variable: holds a list of values or records.
  • Constant: a value that never changes.
  • Formula: a calculated value, written like a formula field, for example TODAY() + 7.
  • Text template: rich text with merge fields, used for email bodies and messages.
  • Choice, record choice set, picklist choice set: answer options on screens.

You refer to a resource with the same merge syntax everywhere: {!varName}, and to a field of a record variable as {!varRecord.Name}. The special global {!$Record} is the record that triggered a record-triggered flow, and {!$Flow.CurrentDateTime} and {!$User.Id} are common global variables.

Versions, activation and run context

Flows are versioned. You edit a draft, press Save, and Activate it when it is ready. Only one version can be active; older versions stay so you can roll back by activating an earlier one. Before you activate, use Debug (covered in Flow errors, debugging and testing). A flow can run in user context or system context: system context ignores the running user's permissions on records and fields, which is powerful and a common source of accidental data exposure.

A flow that runs in system context without sharing can read and change records the current user could never see. Choose the narrowest run context that works, and never assume the person who triggered the flow is allowed to see what it touches.

Stand-in: a tiny flow engine

Here is a stand-in in JavaScript. It is not Salesforce: it models a flow as a list of elements, with an Assignment, a Decision and an Update, so you can see how the data moves from element to element.

JS Stand-in: a flow as a list of elements

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Change Type to "Partner" and run again. The Decision takes the other path, exactly like a Decision element's outcomes (and its Default Outcome) in Flow Builder.

Choosing flow or code

Prefer declarative tools (flow) first; use Apex when the logic is too heavy or too complex. Flow is a good fit for most "when X happens, do Y" rules. Consider Apex code when you need complex algorithms, very large data volumes in one transaction, or fine control of errors and testing. Keep one automation per object event where possible: several flows on the same object and trigger point can run in an order you do not control well, so group related logic into one flow (using Decision elements) or set the Trigger Order property.

JS Stand-in: pick a flow type

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which tools did Flow replace for new automation?

    Workflow Rules and Process Builder are retired; flows are the single declarative automation tool.
  2. 2. A manager wants a guided form that a user starts from a button. Which flow type fits?

    A Screen Flow is started by a user and can show pages with fields.
  3. 3. What does {!$Record} mean in a record-triggered flow?

    {!$Record} is the global variable holding the triggering record; {!$User} is the running user.
  4. 4. Why is system context risky?

    In system context the flow can read or change data the user could not normally access.

Summary

  • Flow is Salesforce's declarative automation tool; it replaces Workflow Rules and Process Builder.
  • The flow type (record-triggered, screen, scheduled, autolaunched, platform event, orchestration) is decided by what starts the automation.
  • Elements are grouped as interaction, logic and data; resources (variables, collections, formulas, constants) hold the data.
  • Flows are versioned: save, debug, then activate one version.
  • Choose run context carefully, and keep related logic together.

Next: Record-triggered flows