Flow Resource Types

In order to use values throughout the flow, you have to store them in resources. Resources are placeholders which represent a value that you can reference in the flow. Existing resources can be found in the Manager tab of Toolbox and new ones can be created by clicking the New Resource button.

Second way to create a resource is to click + New Resource from any resource search box.

Both options will open a popup where you can create a new resource. There are 8 resource types that you can create in flows.

Resource Types

1- Variable

If the value of a resource can be changed during the flow or if you need to reference a field from a Salesforce record, then you need to use a variable. Flow elements that can pull data into the flow, such as a Get Records element, always prompt you to store that data in a variable.

Variable Data Types

After selecting Variable from New Resource popup, you have to give a name to your resource and select the data type of the variable. Select the data type carefully because you can’t change the data type of a previously saved variable.

By default, variables store one value that is compatible with the selected data type. If you need to store multiple values (with the same type) in that variable, mark Allow multiple values checkbox. When that option is selected, you create a collection variable.

Only for variables, you can make the resource available for input or output. When a variable is available for input, a value can be passed from outside when launching the 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. In that case, the value of the variable can be passed from the flow to a subflow.

Text: Text variables store text values only. Use this type of variable if you need to store the value of a single field such as Name, or Id. You can give a default value to a text variable.

Record: Record variables can store multiple fields from a record. If you need to store multiple field values and not just a single text value, use record variable. Since this data type is related to a record, you have to select the object. For example, if you create a variable resource for the account object, you cannot store an opportunity record in this variable.

Number: Number variables store number values only. Use this type of variable if you need to store a single number value. You can give a default value and set decimal places.

Currency: Currency variables store number values only. Use this type of variable if you need to store a single number value. You can give a default value and set decimal places. Value will be displayed with the currency symbol.

Boolean: Boolean variables store true or false values. However unlike checkbox fields, if there is no value assigned, the value of the boolean variable can be null. You can give a default value to a boolean variable.

Date: Date variables store date values and it is possible to give a default value.

Date/Time: Date/Time variables store date and time values together and it is possible to give a default value.

Picklist: Picklist variables store picklist values however it is not possible to give a default value.

Multi-Select Picklist: This variable type store multi-select picklist values but like picklist variables, it is not possible to give a default value.

Apex-Defined: With the Apex-defined data type, flows can manipulate the kinds of complex data objects that are typically returned from calls to web services. Create Apex-defined variables in flows and directly process JSON returned from web calls. You have to select the Apex class that includes the Apex-defined data type. The available options are Apex classes that have @AuraEnabled fields. An Apex-defined variable value can’t be set or stored outside the flow. The value can’t be passed to a subflow element.

2- Constant

Constant resource stores a constant value that does not change during the flow. This type of resource can store Text, Number, Currency, Date, and Boolean values. After selecting the data type, a value can be entered.

3- Formula

Formula resource calculates a value using functions and elements in your flow. It is possible to build a formula using the functions that you already familiar with. However some functions like ISNEW, IMAGE, PRIORVALUE are not supported. Formula resource results can be Text, Number, Currency, Boolean, Date, and Date/Time.

A formula in a flow can’t contain more than 3,000 characters and you can’t activate a flow that contains an invalid formula.

4- Text Template

Text templates can be created to store text that can be changed and used throughout the flow. It is possible to contain a value from another resource in the flow or a global variable.

Text templates support both rich text and plain text views. You can use rich text option to create a formatted text which supports adding links and images. You have to use plain text when using the standard Send Email action however there are custom actions that let you send rich text emails.

5- Choice

You can create a choice to use in a screen component, such as a Radio Buttons, Picklist or Multi-Select Picklist components. It is possible to display a label (supports rich text) but store a different value when this choice is selected. Supported data types to store are Text, Number, Currency, Date, and Boolean. If you want to display a text input component below the choice, mark Display text input checkbox. However, this option isn’t available if the choice’s data type is Boolean.

In the below example, a choice displays ⭐⭐⭐ but when it is selected, it stores number 3.

6- Record Choice Set

Record choice set lets you display records as choices. You can generate a set of choices by using a filtered list of records. To do so, first select the object and then optionally filter records. It is possible to sort records by a field either ascending or descending and also set the maximum number of choices to display.

For each record that meets the filter conditions, the flow creates a choice using values from the record. You can identify which fields to use for each choice’s label and value, which means that you can display the name of the record but store the Id. It is possible to store a Text, Number, Currency, Date, and Boolean field as the choice value. If you need to store more field values from the selected record, you can define variables and assign field values to them.

Here is a record choice set that displays active users ascending by their names. Users see these options by their names but flow stores the Id of the record when it is selected.

7- Picklist Choice Set

Picklist choice set lets you generate a set of choices by using the values of an existing picklist or multi-select picklist field. Picklist choice set is easier to maintain because if someone adds another value to a picklist field, that value will be automatically added to the picklist in the flow and you don’t have to modify your flow to reflect the changes.

After selecting Picklist Choice Set as the resource type, object and an existing picklist or multi-select picklist from that object should be selected. It is important to note that picklist choice set displays all the options from the picklist and does not exclude values according to the record type. It is also not possible to set a default value in a picklist element that uses a picklist choice set since choices are not configured separately.

8- Stage

To represent the user’s progress throughout the flow, stage resources should be created. To identify which stages are relevant to the user throughout the flow, you have to assign the stages to the stage system variables ($Flow.ActiveStages and $Flow.CurrentStage) using the assignment element. You can reference stages in flow logic or in the UI, such as with a progress indicator.

As you can see in the example below, each time the flow moves to a different stage, an assignment element should reset the current stage and add the new stage to the active stages.

Flow design for example of breadcrumb stages

By doing this, you can display the current stage to the user in this format.

Payment details stage

There are also system provided variables that store information about the running user or Salesforce org. These variables are called Global Variables. To read more about them, click here.

Be the first to comment

Leave a Reply

Your email address will not be published.


*