Flow: How To Use Variable / Collection Variable

Variable is definitely one of the first things mentioned in any Programming 101 courses, and that is no difference in Salesforce Flow.

What Is Variable?

flow variable

You can think of a variable as a place holder. In your flow, you can alter the value stored in the variable and use it later.

For example, you set up hotkeys to call people and set 1 as calling your mom. Whenever you press one, the phone will call your mom automatically. The key 1 here is like the variable, and calling your mom is the value stored in the variable.

What Is Collection Variable?

flow collection variable

A collection variable is then a place holder for a group of values.

Following the same example, you set 2 as calling your dad, your sister, and your brother all at once. Since key 2 stores multiple values, we will call it a collection variable.

Note that in Salesforce Flow, the collection variable has orders – which means if you set the order as dad, sister, and brother, this will be the calling sequence every time you hit 2.

What Is Record (Single) Variable?

Then it comes to the more complicated part – Record variable and Record collection variable. Both of them can store many fields, so some of you might think this is a group values. We will not dive into the details, but think about the value here as “the number of records“.
Record (Single) Variable can only store one record, but all the fields of this record can be stored in the same variable.

Imagine on your phone, you set key 3 to show the contact information of your boss. Once you click 3, you can only see your boss’ info showing up, but you can see her/his email, phone, address, etc. Then key 3 will be like a record (single) variable.

What Is Record Collection Variable?

Similar to above, but this time you can store all the fields of several records.

Now you set key 4 to show the contact information of team which has 10 people. When you click 4, you can see all 10 people showing up, and then you can further check into their email, phone, address, etc. Then key 4 will be like a record collection variable.

Check Out How Variable/Collection Can Be Used In Real Cases!
Use Case: Mark A File Upload as Required in Flow
Have you tried the File Upload component in Screen Flow ...
Read More
Use Case: Create Parent and Child Cases in One Flow
Do you need to create a Screen flow that allows ...
Read More
Use Case: Update Order and Order Product Dates Quickly
If you are using order management, do you bump into ...
Read More
Use Case: Update All Related Contacts (Account Contact Relationship)
Do you have the Account Contact Relationship enabled for your ...
Read More

Official Salesforce Help Article On Variable

Notify of
Inline Feedbacks
View all comments