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?
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?
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.