Learn About Flow Resources and Variables

Learning Objectives

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

  • List the resources available in Flow Builder.
  • Describe what a flow variable is.

Before You Start

Before you can complete this module, make sure that you complete the Build a Simple Flow project. The concepts here depend on the flow you build in that project.

Flow Resources

In flows, resources are placeholders similar to merge fields in an email template or a formula. Let's say you start an email with Hi, {!$User.FirstName}. {!$User.FirstName} is a placeholder, so when the email is sent, it displays the actual first name of the user. In each step of the flow (the elements added to the canvas), you can reference flow resources instead of manually entering values.

Let's go over the basic kinds of flow resources available in Flow Builder.

  • Constant represents a fixed value, such as a tax rate.
  • Choice, Picklist Choice Set, or Record Choice Set represents an option in a screen component. With the choice resource, you explicitly set each option's label and value. Choice sets, on the other hand, generate choices for you by using a filtered list of records or the values of a picklist (or multi-select picklist) field in your org.
    Example: In the New Contact flow, the screen prompts the user to select the associated account.
    A screen component labeled “Account” with Acme selected from the picklist
    Rather than building individual options for each account in your org, a record choice set generates the options.

    To generate an option for each account record in your org, the record choice set uses the default filters. Every choice consists of two components: a label to display in the screen component, and a value to use when the choice is referenced elsewhere in the flow. The way this record choice set is configured, the screen component displays the account name for each option.

    When the flow user selects an account:
    • The value of the screen component is set to the choice value (1): the ID of the selected account.
    • The selected account ID is stored in the {!contact.AccountId} record variable (2).
      Settings for a record choice set, where each choice label is set to the record's Name field and each choice value is set to the record's ID value. In addition, the ID of the selected account record is stored in the AccountId field on the {!contact} record variable.
  • Formula represents a calculated value, similar to a formula field. For example, create a formula that calculates 30 days from today, then reference that formula to set an opportunity close date.
  • Text Template represents some formatted text. For example, format the body of an email or Chatter post in a text template, then reference the text template in the appropriate action.
  • Variable represents a value that can change throughout the flow. We're going to spend the rest of this unit diving deep on variables.


This isn't a comprehensive list. For details about all available resources, see the Resources section of this unit.

Introducing Variables

The word variables can make you think of algebra classes or writing code in some scary language like Apex. However, they're an important thing to understand when you're building flows. Don't worry, no programming (or math) experience required.

Simply put, a variable is a placeholder for a value you don't know yet. Every flow resource is a placeholder, but variables are the only resource that can change during the flow, hence the name “variable.” In fact, Flow Builder includes the Assignment element just for updating the values of variables. Watch a quick video for more information on what a variable is.

When Do I Create a Variable?

Use a variable when a value can differ based on certain conditions. Perhaps the value depends on which record the flow operates on, or perhaps it depends on the result of some logic in the flow.

You can't reference a field from a Salesforce record directly, so the field value must be stored in the flow using a variable. Flow elements that can pull data into the flow, such as a Get Records element or a Post to Chatter core action, always prompt you to store that data in a variable.

Example: In the Build a Discount Calculator project, the flow updates an opportunity's Discount field. But not every opportunity gets the same discount; it's determined by the associated account's revenue. A variable acts as a placeholder for the discount percentage and is set to a different percentage based on the flow logic. The flow then uses the variable to update the opportunity's discount.

 A section of a flow that uses a Decision element to evaluate an opportunity, one of three Assignment elements to set the appropriate discount percentage, and an Update Records element to make the change.

Now that you're more familiar with the resources available in Flow Builder, let's put that into practice by creating a variable.


Keep learning for
Sign up for an account to continue.
What’s in it for you?
  • Get personalized recommendations for your career goals
  • Practice your skills with hands-on challenges and quizzes
  • Track and share your progress with employers
  • Connect to mentorship and career opportunities