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: Update All Related Contacts (Account Contact Relationship)
Do you have the Account Contact Relationship enabled for your ...
Read More
Use Case: Create an Easy Login Flow
Do you want to enforce the entry of certain user ...
Read More
Use Case: Clone Any Objects with Related Lists with Flow
"Clone with related" is an amazing feature which sadly is ...
Read More
Use Case: Simple Loop Example in Flow
Earlier we have published the how-to-guides on Loop and Counter, ...
Read More
Use Case: Simple Counter Example in Flow
Earlier we have published the how-to guides on Loop and ...
Read More
Use Case: Mass Update Records From Related List #2
In this article we introduced the magical ids variable to ...
Read More
Use Case: Mass Update Records From Related List #1
Have you heard of inline editing? This is my favorite ...
Read More
Use Case: Create Custom Roll-Up Summary With Flow
I have really mixed feelings about the roll-up summary field ...
Read More
Use Case: Notify Owners When Case Merged Or Master Case Closed
I believe many are excited about the Case Merge release ...
Read More
Use Case: Clone Assets To Opportunity Products
I received this case to auto-create Opportunity Product or Quote ...
Read More
Use Case: Add Clone Button To Each Record In A Related List
If you migrated from Classic to Lightning, you must have ...
Read More
Use Case: Auto-Generate Multiple Lines Of Opportunity Product
* Updated at Mar. 25, 2021. The original flow is ...
Read More

Official Salesforce Help Article On Variable

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments