Loading
Prepare for Email to Become the Default Login ExperienceRead More
Intermittent freezing when using using certain browser versionsRead More
Automate Your Business Processes with Salesforce Flow
Variable Resource

Variable Resource

Store a value that can be used or changed throughout the flow.

Required Editions

This video explains what variables are and how flows use them to hold data.

View this video in a separate tab.

This video explains variable types including common types, Boolean, Apex-defined, and collection variables.

View this video in a separate tab.

Field Description
Apex Class The Apex class that defines fields for the Apex-defined data type. Only fields with the @AuraEnabled annotation are available in a flow.
API Name

The requirement for uniqueness applies only to elements within the current flow. Two elements can have the same API name, provided they're used in different flows. An API name can include underscores and alphanumeric characters without spaces. It must begin with a letter and can’t end with an underscore. It also can’t have two consecutive underscores.

When you pass a variable to a subflow input, the variable API name can be up to 40 characters long.

Description Helps you differentiate this variable from other resources.
Data Type

Determines the types of values that the variable can store. You can’t change the data type of a previously saved variable.

The Record data type can store multiple field values for one record. The Apex-defined data type can store multiple field values for one Apex class.

Looking for sObject? In Flow Builder, that data type changed to Record.

Allow multiple values (collection)

When selected, the resource is a collection variable. You can store a list of values in collection variables. Collection variables can store only values that are compatible with its data type. When the data type is Record, the collection variable can only store values for the associated object’s records.

For example, store multiple email addresses in a collection variable, and reference the collection variable to send an email.

Object

The object whose field values you can store in the variable. You can’t change the object of a previously saved variable.

Available only when the data type is Record.

Decimal Places

Controls the number of digits to the right of the decimal point up to 17 places. If you leave this field blank or set it to zero, only whole numbers appear when your flow runs.

Available only when the data type is Number or Currency.

Availability Outside the Flow

When a variable is available for input, it can be set at the start of the flow, such as when a flow is started from a Lightning page, a process, or another flow. When a variable is available for output, it can be accessed throughout the flow, such as by a Lightning web component or another flow.

The default value of the field depends on the release or API version in which the variable is created.

  • If the variable was created in Summer ’12 or later, or in API version 25.0 or later, by default the variable isn’t available for input or output.
  • If the variable was created in Spring ’12 or earlier, or in API version 24.0 or earlier, by default the variable is available for both input and output.

Disabling input or output access for an existing variable can break the functionality of applications and pages that call the flow and access the variable. For example, you can access variables from URL parameters, processes, and other flows.

This field doesn’t affect how variables are assigned or used within the same flow, for example, through these types of elements: Assignment, Create Records, Get Records, and Apex Action.

Default Value

Determines the variable value when the flow starts. If you leave this field blank, the value is null.

Not available for Picklist and Multi-Select Picklist variables.

 
Loading
Salesforce Help | Article