This is the most complex data element, so we will break down each part to illustrate.
1. Sort Order
There are three options – Not Sorted, Ascending, Descending. Ascending is from the smallest number to the biggest (if it is date, then it is the oldest to the latest) and Descending is the opposite. You would only want to sort them if later the order matters, for example you want to take the first X records sorted by date. Otherwise leave it unsorted to speed up the execution.
2. How Many Records to Store
If you are only taking the first smallest number, or the one latest date, this will be an extremely helpful feature combining with the first feature. However if you want to take more than one, you will have to store all records and use other elements to handle this. (Ex. Loop, Decision, etc)
3. How to Store Record Data
This is the most complicated setting, and there are four possible scenarios:
3 – 1. Automatically Store All Fields
The most straight forward option. After you choose this, a variable will be automatically created and you can reference all the fields later in the flow. If you only store the first record (Feature 2), it will be a record (single) variable; if you store all records, it will be a record collection variable.
3 – 2. Choose Fields and Let Salesforce Do the Rest
Similar to the first option, the system will also create the variable automatically for this option. The only difference is that you can choose specific fields to get.
Pros: The flow can run faster
The less fields you get, the less the system has to do. Thus, your flow can run faster.
Cons: Potential error might occur
If later you reference the fields that are not specified here, the flow will break.
(For example, I only got Date and Unit Price in graph 3-2.1. If I want to use the List Price to update another variable as graph 3-2.2, I will hit an error as graph 3-2.3.
3 – 3. Choose Fields and Assign Variables – When Get Only One Record
When choosing “Together in a record variable”, the outcome will be similar to choosing fields and letting Salesforce do the rest. However here you can assign a specific variable to store all the values.
Alternatively you can store each field into a separate variable.
These two options in general will take more time for the system to run, and the use case is rare (Which is why there is (advanced) at the back). It might be that you have the variables set in another Apex script of flow, so you want to manually assign these values to unify the names across different places.
3 – 4. Choose Fields and Assign Variables – When Get All Record
Same as 3-3, here you need to assign a specific collection variable to store all the values.
|Automatically Store All Fields||Need most of the fields;|
Want to prevent potential errors;
Flow is too small so tiny inefficiency can be omitted.
|Choose Fields and Salesforce Do the Rest||Only need 2-3 fields;|
Flow is huge so performance is vital.
|Choose Fields and Assign Variables||Variables are already set and want to unify the names.|
Check Out How Get Records Can Be Used In Real Cases!