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: Use Flow To Auto Close The Spam Case
Spam is like a never-ending fight, especially for marketing and ...
Read More
Use Case: Clone Opportunity Products To Assets
Last time we introduced a solution to clone Assets into ...
Read More
Use Case: Collection Sort To Calculate Upcoming 3 Opportunities
Today we will use this easy use case to illustrate ...
Read More
Use Case: Update Parent From A Collection of Child Records in Flow
One powerful thing that variables can do in Flow is ...
Read More

Official Salesforce Help Article On Variable

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments