Start tracking your progress
Trailhead Home
Trailhead Home

Guide Users Through Your Business Processes with Flow Builder

Learning Objectives

After completing this unit, you'll be able to:

  • Define a flow and list its key components.
  • Describe the types of flow elements.
  • Build a flow that creates a record and uploads files.

Get Started with Flow Builder

You may have heard several terms used interchangeably when referring to flows. As a reminder, the official terms are:

  • Lightning Flow—the product that encompasses building, managing, and running flows and processes.
  • Flow Builder—a point-and-click tool for building flows.
  • Flow—an application that automates a business process by collecting data and doing something in your Salesforce org or an external system.

In short, the Lightning Flow product includes a couple of tools. One of them, Flow Builder, lets you create flows.

Beyond the Basics

You may also have heard of features called Cloud Flow Designer or Visual Workflow. Cloud Flow Designer has been replaced by Flow Builder, a much faster tool that streamlines flow building and maintenance with a simplified user interface. Visual Workflow is a retired feature for designing, managing, and running flows. Visual Workflow has also been superseded by Lightning Flow.

Flow Building Blocks

Every flow is made up of three building blocks.

Elements, connectors, and resources in a flow
  • Elements (1) appear on the canvas. To add an element to the canvas, click it or drag it there from the toolbox.
  • Connectors (2) define the path that the flow takes at runtime. They tell the flow which element to execute next.
  • Resources (3) are containers that represent a given value, such as field values or formulas. You can reference resources throughout your flow. For example, look up an account’s ID, store that ID in a variable, and later reference that ID to update the account.

Flow elements fit into four different categories.

Screen
Display data to your users or collect information from them with Screen elements. You can add simple fields to your screens, like input fields and radio buttons as well as out-of-the-box Lightning components like File Upload.A flow screen that's built with out-of-the-box fields and components

If you need more out of your flow screens, like custom navigation or information displayed in table format, build or install custom Lightning components.A flow screen built with custom components.

Logic
Control the flow of... well, your flow. Create branches, update data, loop over sets of data, or wait for a particular time.
Actions
Do something in Salesforce when you have the necessary information (perhaps collected from the user via a screen). Flows can look up, create, update, and delete Salesforce records. They can also create Chatter posts, submit records for approval, and send emails. If your action isn’t possible out of the box, call Apex code from the flow.
Integrations
Connect your flow to an external database by using core actions or Apex actions. Core actions let you make requests without going through the Salesforce server. Flow Builder also has a couple of tie-ins to platform events. Publish platform event messages with a Create Records element. Subscribe to platform events with a Pause element.

Take a Tour

When you build flows, you work from Flow Builder.

Screenshot of Flow Builder's user interface with numbers pointing at the toolbox, canvas, and button bar
Button Bar (1)
The button bar provides information about the flow, such as:
  • Whether the flow is active or not.
  • How long ago the flow was saved.
  • Whether the flow has any warnings or errors. To see the warnings or errors, click the respective icon.
Canvas (2)
The canvas is the working area, where you build a flow by adding elements. As you add elements to the canvas and connect them together, you see a visual diagram of your flow.
Toolbox (3)
The toolbox contains the elements and resources you’ll use to build your flow.
  • From the Elements tab, add new elements, like Screen and Create Records, to your flow.
  • From the Manager tab, create resources, such as variables, stages, and choices, to use in your flow. Or view a list of all elements and resources that you’ve added to the flow.
Keyboard Shortcuts
Use these handy keyboard shortcuts to quickly navigate your flow.
In Windows...
  • To zoom in, press CTRL =.
  • To zoom out, press CTRL -.
  • To zoom to fit, press CTRL 0.
  • To zoom to view, press CTRL 1.
  • To select multiple elements on the canvas, press and hold Shift and click each element.
For Mac...
  • To zoom in, press Command =.
  • To zoom out, press Command -.
  • To zoom to fit, press Command 0.
  • To zoom to view, press Command 1.
  • To select multiple elements on the canvas, press and hold Shift and click each element.

Build a Flow

Depending on your page layouts, objects can have lots of fields, which can overwhelm users who just want to create a record quickly. Let’s build a flow to streamline account creation. When it runs, our flow collects user input about a new account, creates an account record, and lets the user upload files to the account record.
Tip

Tip

Plan out your business process before you try to automate it. Doing so makes it easier to configure when you use one of our automation tools.

From Setup, enter Flows in the Quick Find box, then select Flows, click New Flow, then select Screen Flow and click Create.

Add a Screen to Collect User Input

  1. From the toolbox, drag a Screen element onto the canvas.
  2. Name it New Account in the Label field.
  3. In Screen Components, click Text and then click Text again.
  4. Select the first Text screen component and enter Account Name in the Label field.
  5. Select the second Text screen component and enter Phone Number in the Label field.
  6. Select the footer and on the right and under Control Navigation, deselect Previous and Pause.
    Screenshot of the Screen Components screen
  7. Click Done.

Add a Create Records Element to Create Records

The Create Records element uses the values from New Account to create an account record.
  1. From the Toolbox, drag a Create Records element onto the canvas. Name it Create Account.
  2. For How to Set the Record Fields, select Use separate variables, resources, and literal values.
  3. In Create a Record of This Object, in Object, select Account.
  4. In Field, select Name.
  5. In Value, select SCREEN COMPONENTS | Account_Name.
  6. Click Add Field.
  7. In Field, select Phone.
  8. In Value, select SCREEN COMPONENTS | Phone_Number.
  9. In Store Account ID in Variable, select New Resource from the Variable dropdown. The New Resource window appears.
    1. In Resource Type, select Variable.
    2. Name the API Account_Id.
    3. In Data Type, select Text.
    4. Click Done.
  10. In Store Account ID in Variable, select VARIABLES | Account_Id from the Variable dropdown.
    Make sure that your Create Records element looks like this.Screenshot of the Edit Create Records screen
  11. Click Done.

Create the Screen That Enables File Uploads

The second screen element lets users upload files for the account that they created.
  1. Drag another Screen element onto the canvas.
  2. In Screen Properties, configure these settings.
    1. Name the screen Upload Files in the Label field.
    2. Under Control Navigation, deselect Previous and Pause.
      If you don't make that selection users will be able to navigate back to the first screen, and multiple accounts could accidentally be created.
  3. On the left in Screen Components, click File Upload.
    1. For API Name, enter accountFiles.
    2. For File Upload Label, enter Upload Related Files.
    3. For Related Record ID, select VARIABLES | Account_Id.
    4. For Allow Multiple Files, select $GlobalConstant.True.
    The field settings for the file upload component field
  4. Click Done.

As configured, this File Upload component lets users upload more than one file at a time to the created account.

Connect the Elements to Finish the Flow

Connecting the flow elements tells the flow what order to follow at runtime.
  1. Click the node at the bottom of Start and drag it to New Account.
  2. Click the node at the bottom of New Account and drag it to Create Account.
  3. Click the node at the bottom of Create Account and drag it to Upload Files.
    Connecting New Account to Create Account and Create Account to Upload Files
  4. Save the flow, name it Quick Account in Flow Label.
  5. Click Save.
    Skip the warning you see about Lightning runtime. We talk about that next.

Make Your Flows Look Like Lightning

Salesforce offers two runtime experiences that determine the look and feel when someone runs a flow. To make your flows blend in with Lightning Experience, make sure that Lightning runtime is enabled in your org.
  1. From Setup, enter Automation in the Quick Find box, and then select Process Automation Settings.
  2. Verify that Enable Lightning runtime for flows is selected.
  3. Save your changes.
Note

Note

This setting only affects URL-based flows. That includes flows that are run from custom buttons or the Run button in Flow Builder. For more details, see Lightning Flow Runtime vs. Classic Flow Runtime.

Distribute Your Flow

Now it's time to distribute our flow to the right users. To do so, we add it to the Home page.
To learn about more ways to distribute a flow, check out the Screen Flow Distribution module.

Activate Your Flow

Only active flows are available in the Lightning App Builder, so first activate the flow.
  1. From Setup, enter Flows in the Quick Find box, then select Flows.
  2. Click Quick Account.
  3. From the button bar in Flow Builder, click Activate.

Add Your Flow to the Home Page

  1. Create a home page.
    1. From Setup, enter Builder in the Quick Find checkbox, and then select Lightning App Builder.
    2. Click New.
    3. Select Home Page and click Next.
    4. Give the page a name and click Next.
    5. Click CLONE SALESFORCE DEFAULT PAGE, select Home Page Default, and click Finish.
  2. Drag a Flow component to the top of the right column.
    Dragging the Flow component onto a home page
  3. For Flow, select Quick Account.
  4. Save your changes and activate the page. Mark this page as the default home page and click Save.
  5. To see your flow in action, go to your Home page.
    1. Click Back to return to Setup.
    2. Click App Launcher icon, and under All Items, click Home.
Resulting home page

Make Sure Your Users Can Run the Flow

To make sure that your users can run the flow, add the Run Flows user permission to a permission set or profile, and assign it to the right users. If Override default behavior and restrict access to enabled profiles or permission sets is selected for the flow, add the flow to a permission set or profile, and assign it to the right users.
Note

Note

Only flow admins (users with the Manage Flow user permission) can run inactive flows.

Tell Me More...

  • A flow interview is a running instance of a flow. When you distribute a flow, users interact with individual interviews of that flow.
  • This unit walked you through a simple example of a flow. You can customize that flow to do much more. For example, enhance the Quick Account flow so that it provides values for more account fields, like Account Number or Ownership. Or use the same inputs to also create a contact and an opportunity.

Resources