The Ultimate Guide to Salesforce Flows


Lightning Flows (AKA Flows) can help you automate complex business processes and manual data entry. Flows let you work smarter, not harder, by saving your users’ time and making sure the required tasks are being done.

As a Salesforce admin, Flows can be one of the most powerful tools in your toolbelt. When set up properly, Flows can make you look like a rockstar to your sales team, but if your Flows aren’t configured correctly, they can also be difficult to manage or make a mess (kinda like a rockstar!)

This guide will teach you everything you need to know about Flows – let’s dive in!

What is a Flow?

In Salesforce, Flow is an application inside Salesforce to automate complex business processes. Simply put, they collect data and then do something with that data.

Flow Builder is the declarative interface that we use to build individual flows. Flow Builder can be used to build code-like logic without the requirement of knowing a programming language.

Flows in Salesforce can be implemented in five ways:

  • Screen Flows
  • Schedule-Triggered Flow
  • Auto Launched Flow
  • Record-Triggered Flow
  • Platform Event-Triggered Flow
Screen Shot 2020-08-14 at 10.40.54 AM.png

When/why do I use a Flow?

In most cases, the type of automation to use for a specific process can be determined by evaluating where the data for the processes originates from and where it needs to go.

  • Flows are able to create, edit, and delete any record passed into the flow. Records do not have to be related to pass data in a flow. Flows are also able to be scheduled to run on a set interval with a collection of records.
  • Workflow field update can write data to the same record that invoked the workflow rule or the master record of a master-detail relationship on the record that invoked the rule. Workflow rules are not able to create, edit or delete records.
  • Process builder can be used to write data to the same record that invoked the process or records related by either lookup or master-detail relationships. Processes can also create records but not delete.

When should I not use a Flow?

Generally, you should not use a flow in the following situations:

  • Simple Field, Email Alerts or record updates that can be better handled by a Process Builder or Workflow rule. Generally, flows are used for more complicated logic, similar to Apex, that can be accomplished in a declarative manner. For example, if you would like the Stage of an opportunity to be set to New when it is created, along with an email alert being sent to a Sales Manager, it is better to create this as a Workflow Rule or Process Builder.
  • Complicated logic that is better managed in Apex code. An example of this is the flow above that was shared in a well-known Salesforce group. The logic in this flow is so complicated, that it makes debugging a pain, and also makes documenting and managing the flow difficult also. Complicated logic like this is better served through well-built Apex code, which makes it easier to document the logic, changes and also debug issues with it.
  • Simple Record Creation. For example, if you would like to create an Order when an opportunity is moved to Closed Won, it is better to use a Process Builder to complete this action, as it is easier to set up and manage.
  • When your Edition limits how many flows you can create. Essentials and Professional editions have a limit of 5 Process Builders and Flows in each org. For most logic in these editions, it is easier to create a Process Builder to handle them.

How do I create a Flow in Salesforce?

Below are the steps to create flow:

  1. Open Flow Builder: From Setup, enter “Flows” in the Quick Find box, select Flows, and then click New Flow.
  2. Select the flow type, and click Create.
  3. Drag the elements you want to use onto the canvas. Each element represents an action that the flow can execute. Examples of such actions include reading or writing Salesforce data, displaying information and collecting data from flow users, executing business logic, or manipulating data.
  4. Connect the elements to determine the order in which they’re executed at run time. Don’t forget to connect the Start element to another element.
  5. Save your flow.

After you build a flow, make sure that it’s working as you expect it to by testing it thoroughly to make sure that it works as expected. Then activate the flow. You’re now ready to distribute the flow to users.

Pro tip: Flows can be executed in several ways, depending on who the flow is designed for. Internal users, external users, or systems can run a flow, or a flow can be deployed for another organization.

Flows vs Apex

Flows and Process Builders are similar. Here are some of the key differences and similarities between the two:

  • Apex requires a dev and Sandbox to deploy, meaning it can only really be built in organizations that are Professional and above. Flows can be built in all editions, as a sandbox is not required for deployment.
  • Apex is not available in Essentials, and some Apex features are limited in Professional. Orgs with Enterprise and above have no Apex limitations. Flows features are not limited based on the edition.
  • Apex requires constant development and discipline with upkeep. Flows are less work to keep up to date.
  • Flows can be built by admins, while Apex is typically built by devs only.
  • Apex is considered a tool of last resort. Flows are simpler and should be used before Apex.
  • However, to the point above as to when you should not use a flow, if the logic is too complex, Apex should be used. There is unlimited potential with Apex, Flow capabilities are catching up but are still behind Apex.
  • Renewal Generation, OLI creation and other pieces of automation that were traditionally built as Apex can now be built as flows, preserving code space for projects that require Apex.

Apex should be used in the following scenarios;

  • Complex Salesforce automation that requires multiple steps and actions, where a flow will become cumbersome.
  • Custom-built integrations with other systems (such as a connection to a SQL database that requires bi-directional syncs)
  • ERP integrations.

When should I use Flows vs Process Builder?

Flows and Process Builders are similar. Here are some of the key differences and similarities between the two:

  • Process Builder is more user-friendly in terms of its setup and management. Setting up a flow takes more time and is significantly more complex.
  • Flows allow you to add screens where users can enter data
    • Process Builders do not have this capability.
  • Flows can be invoked, started by users, triggered by a record change, or schedule to run on their own at a custom time and frequency..
    • Process Builders run automatically (either immediately or scheduled) when criteria is met. They can also be invoked by another process builder.
  • Flows and Process Builders can have scheduled actions.
  • Flows can be paused by users, Process Builders run when the criteria is met and cannot be paused.
  • Flows and Process Builders both contribute to CPU limits and other automation limits in Salesforce.
  • Process Builder actions are executed in the order in which they appear in the process definition.
    • Flows can have different and more complex orders of operations.
  • Flows can be built to cycle through multiple unrelated and related objects.
    • Process Builders are limited to the base object (i.e Opportunities) and related objects (Accounts).
  • The following actions are available in Process Builders only:
    • Quip Actions
    • Send Survey Invitation
    • Invoke a flow
  • Flows can be designed to run before a record has been saved to the database or after the record has been saved.
    • Process Builder can only trigger after a record has been saved.
  • Flows can be designed to trigger upon creation, update or deletion of a record.
    • Process Builder can trigger only for creation or updates to a record.

Here are real-life examples where a Process Builder makes more sense:

  • Automatically submit an opportunity for approval when the value in the Amount field is greater than $200,000
  • When an account is deactivated, deactivate all the associated contacts.
  • After creating a new user or internal contact, create a case for background verification.
  • Invoke custom approval logic that is written in Apex code.

What’s the difference between Flows and Workflow Rules?

Flows and Workflow Rules (WFRs) are similar. Here are some of the key differences and similarities between the two:

  • Flows are available in all Salesforce Editions, including Essentials. WFRs are not available in Essentials or Professional Edition.
  • WFRs are not actively being updated by Salesforce (but you can still use them for the time being).
    • Flows are constantly being updated in each release with new features and capabilities.
  • There are limitations with how many WFRs can be active at once, but they typically do not contribute to CPU limits UNLESS the WFR triggers a Process Builder or Flow through one of its updates (a field update for example).
  • Both Flows and WFRs can have scheduled actions.
    • WFRs are limited to 1000 time triggers per hour.
  • WFRs can only make one decision.
    • You can call other flows and Apex with a flow.
  • WFRs are limited to just a few actions: creating a Task record, sending an email, updating a field, or sending an outbound message.
    • Flows can do all of these actions and much more.

Here are some use cases where a WFR makes more sense than a flow.

  • Simple field updates, such as
    • Outbound Emails
    • Sending Email alerts when High Priority Cases are created.

Testing Flows

While the testing tools with flows are limited, you do have the capability to test a flow before activating it.

To test a flow, you can input variables and click Debug to run through it, to make sure it works properly. This is especially true with Screen Flows.

Note that as of the Winter ’21 release, a beta feature called Debug on Canvas is available. This feature makes flow debugging easier by visually demonstrating the path your flow will take when it runs. It also shows query limits of the flow in the debug details.

Which Automation Tool Do I Use?

Prior to the Spring ’19 release, you built Flows in the Cloud Flow Designer tool. In Spring ’19 Salesforce introduced Flow Builder, a faster, more intuitive front-end interface to build your Flows.

Common Mistakes When Designing Flows

  • Using the wrong Field or Variable
  • Too many SOQL queries
  • Object & Field Level Security for running user
  • No Access to Running Flows

What are the different types of Flows?

Flows fall into five categories:

  • Screen Flows: 
    • These are flows that have a UI element and require input from users. These types of flows are either launched as an action or embedded as an element on a Lightning Page.
  • Schedule-Triggered Flow:
    • Launches at a specified time and frequency for each record in a batch. This autolaunched flow runs int he background.
  • Autolaunched Flows: 
    • These flows are used to run automated tasks. Autolaunched Flows can be invoked from process builder, from within an apex class, from a set schedule, from record changes, or from platform events.
  • Record-Triggered Flow:
    • Launches when a record is created, updated, or deleted. This autolaunched flow runs in the background.
  • Platform Event-Triggeed Flow:
    • Launches when a platform event message is received. This autolaunched flow runs in the background.

Where is the flow builder in Salesforce?

To find the flow builder in Salesforce (Lightning) go to Setup > Process Tools > Flows

Screen Shot 2020-08-10 at 11.03.20 AM.png

What are the different types of flows in Salesforce?

Auto-Launched Flows with No Flow Trigger

Doesn’t require user interaction. This flow type doesn’t support screens, local actions, choices, or choice sets. The available distribution methods available are:

  • Flow actions
  • Lightning pages
  • Lightning community pages
  • Custom Aura components
  • Custom Lightning web components
  • Custom buttons or custom links
  • Web tabs
  • Direct flow URLs
  • Visualforce pages
  • Lightning Out
  • Embedded Service deployments

Auto-Launched Flows with a Schedule Trigger

Runs only from a schedule that the user sets. This flow type doesn’t support user interaction, screens, local actions, choices, or choice sets. The available distribution methods are:

  • Processes
  • Custom Apex classes
  • Web tabs
  • Custom buttons or custom links
  • Visualforce pages

Screen Flows

Requires user interaction because it includes screens, local actions, steps, choices, or dynamic choices. Screen flows don’t support Pause elements. A schedule-triggered flow runs only at the scheduled time and frequency.

Auto-Launched Flows with a Record Trigger

These flows are designed to quickly make simple changes to a record when the record is created, updated, or deleted. The flow can also be configured to make those changes either before the record has been saved to the database, or after. In a before-save flow, the supported elements are: Assignment, Decision, Get Records, and Loop. After-save flows have access to all flow capabilities except launching sub flows.

User Provisioning Flow

Provisions users for third-party services. For example, use this flow type to customize the user provisioning configuration for a connected app to link Salesforce users with their Google Apps accounts. A user provisioning flow can only be implemented by associating it with a connected app when running the User Provisioning Wizard.

Field Service Mobile Flow

Requires user interaction because it has one or more screens.

Field Service Embedded Flow

Requires user interaction because it has one or more screens.

Contact Request Flow

Requires user interaction because it has one or more screens. Use one of the following Experience Builder components to add this flow:

  • Contact Request Button & Flow—launch the flow in a popup window
  • Flow—embed the flow directly on the page

See more here:

What is a Flow Interview in Salesforce?

flow interview is a running instance of a flow. A flow is an application built by your administrator that asks you for inputs and does something in Salesforce based on those inputs.

For example, a flow could provide a call script for customer support calls and use the information you provide to create a case. What the flow does with the information you provide is entirely up to your administrator.

When you run a flow interview, whether through a link, button, or tab, you’re running a single instance of a flow. If the terminology is confusing, consider the difference between a record and an object. You create an account record, which is a single instance of the Account object that your administrator customized.

See more here:

How do you call a flow from a button in Lightning?

Since Winter ’18, Salesforce has offered an easier way to trigger a flow from a Quick Action button in Lightning. Note that only Screen Flows or Field Service Mobile Flows may be launched from a Quick Action button. Here are the instructions:

  1. Create a Custom Action
    for the record in Question, by going to Object Manager → (Object Name) → Buttons, Actions and Links
  2. Select type as Flow for the Custom Action
  3. Configure the Custom Action to reference the flow and name it.
  4. Add the Custom Action to the page layout you would like to have it on.

Using PRIOR Value of a record in Lightning Flow

After Spring’21 Release Salesforce will allow you to add access to the PRIOR Value of a record in the Lightning Flow, similar to the Process Builder. This is a major enhancement that will ultimately bring Flow to the next level.

After selecting the object Salesforce will automatically create a record variable ($Record__Prior) of the type selected object. Now you can refer to it anywhere in the flow.”

Where can I find Salesforce documentation on Flows?

You can find the official documentation here.

We also recommend completing the Build Flows with Flow Builder trail on Trailhead

Read more about Flow Builder