---
schema_version: "1"
id: f469cf7e85c0225431c4f4d9d73a6f3611db6b21e805016a916c50e376d1cf3e
title: Variable Resource
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/flow_ref_resources_variable.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.flow_ref_resources_variable.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 96d056d9998d7bda540ed686314c82a645d353bfe8ed17f6de2f76ab376de25e
description: Store a value that can be used or changed throughout the flow.
products:
  - Flow Builder
  - Salesforce Platform
release: "264"
---
# Variable Resource

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

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;"><a href="https://help.salesforce.com/s/articleView?id=platform.flow_ref_supported_editions.htm&amp;release=264.0.0&amp;type=5" title="Learn about the editions and user interfaces that support Flow Builder. Some Flow Builder features integrate with other Salesforce products that require additional licenses.">View supported editions.</a></td></tr></tbody></table>

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

View this [video](https://play.vidyard.com/MppqcKZd36p1YYX8iUruXi.html) in a separate tab.

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

View this [video](https://play.vidyard.com/Arao1M9qodyVTgW8myyU2J?) in a separate tab.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:24%">
          <col style="width:76%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d143108e93">
              <strong>Field</strong>
            </th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d143108e99">
              <strong>Description</strong>
            </th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d143108e93 ">
              <strong class="uicontrol">Apex Class</strong>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d143108e99 ">The Apex class that defines fields for the Apex-defined data type. Only fields
              with the @AuraEnabled annotation are available in a flow.</td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d143108e93 ">
              <strong class="uicontrol">API Name</strong>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d143108e99 ">
              <p>
                <span>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.</span>
                <span>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.</span>
              </p>
              <p style="margin-bottom:0;">When you pass a variable to a subflow input, the variable API name can be up to
                40 characters long.</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d143108e93 ">
              <strong class="uicontrol">Description</strong>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d143108e99 ">Helps you differentiate this variable from other resources.</td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d143108e93 ">
              <strong class="uicontrol">Data Type</strong>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d143108e99 ">
              <p>Determines the types of values that the variable can store. You can’t change
                the data type of a previously saved variable. </p>
              <p>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.</p>
              <p style="margin-bottom:0;">Looking for sObject? In Flow Builder, that data type changed to
                Record.</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d143108e93 ">
              <strong class="uicontrol">Allow multiple values (collection)</strong>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d143108e99 ">
              <p>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.</p>
              <p style="margin-bottom:0;">For example, store
                multiple email addresses in a collection variable, and reference the collection
                variable to send an email. </p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d143108e93 ">
              <strong class="uicontrol">Object</strong>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d143108e99 ">
              <p>The object whose field values you can store in the variable. You can’t change
                the object of a previously saved variable.</p>
              <p style="margin-bottom:0;">Available only when the data type is
                Record. </p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d143108e93 ">
              <strong class="uicontrol">Decimal Places</strong>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d143108e99 ">
              <p>
                <span>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.</span>
              </p>
              <p style="margin-bottom:0;">
                <span>Available only when the data type is Number or Currency.</span>
              </p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d143108e93 ">
              <strong class="uicontrol">Availability Outside the Flow</strong>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d143108e99 ">
              <p>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. </p>
              <p>The default value of the field depends on the release or API version in which the
                variable is created.</p><a name="flow_ref_resources_variable__ul_c4k_tcj_j2c"><!-- --></a>
              <ul id="flow_ref_resources_variable__ul_c4k_tcj_j2c">
                <li>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. </li>

                <li>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.</li>

              </ul>
              <p style="margin-bottom:0;">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.</p>
              <p style="margin-bottom:0;">
                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. </p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d143108e93 ">
              <strong class="uicontrol">Default Value</strong>
            </td>

            <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d143108e99 ">
              <p>Determines the variable value when the flow starts. If you leave this field
                blank, the value is <code>null</code>. </p>
              <p style="margin-bottom:0;">Not available for Picklist and
                Multi-Select Picklist variables.</p>
            </td>

          </tr>
        </tbody>
      </table>

#### See Also

- [Simultaneously Update Fields in Multiple Records Example](https://help.salesforce.com/s/articleView?id=platform.flow_ref_elements_loop_example.htm&release=264.0.0&type=5 "This example creates a flow that updates fields in multiple records by reassigning account ownership based on business rules.")
- [Loop Element](https://help.salesforce.com/s/articleView?id=platform.flow_ref_elements_loop.htm&release=264.0.0&type=5 "Start a loop path for iterating over items in a collection variable. For each iteration, the flow temporarily stores the item in the loop variable. To run actions on each item’s field values, use other elements in the loop.")
- [Flow Operators in Assignment Elements](https://help.salesforce.com/s/articleView?id=platform.flow_ref_operators_assignment.htm&release=264.0.0&type=5 "Use Assignment element operators to change the value of a selected resource.")
- [Flow Resources](https://help.salesforce.com/s/articleView?id=platform.flow_ref_resources.htm&release=264.0.0&type=5 "Each resource represents a value that you can reference throughout the flow.")
- [Flow Variable Considerations](https://help.salesforce.com/s/articleView?id=platform.flow_considerations_feature_variable.htm&release=264.0.0&type=5 "Before you create a variable resource, understand the behavior of variables in flows.")
- [Transform Element](https://help.salesforce.com/s/articleView?id=platform.flow_ref_elements_transform.htm&release=264.0.0&type=5 "Select the flow resources for mapping and transforming source data to target data. You can use the Transform element in screen flows, autolaunched flows with no triggers, and record-triggered flows.")