New Collection Action – Return First N Records
I’ve added a new action to the library of Collection Actions. This action will take, for input, a collection of records and a count then it will return, for output, a collection of records along with a count of how many records were returned.
The primary reason I created this action was to address the desire to programatically specify the number of records to keep in the standard flow Sort element. Currently, you must hard-code that value when configuring the Sort element.
With this new action, you can take the entire output of the Sort element or any other record collection and then use a flow resource (variable, formula, etc) to specify how many records you want to keep.
If there are more records in the input collection than the number requested (N), it will return the first N records. If there are fewer records in the input collection than the number requested, it will return the entire collection as well as a count of the number of records in the output collection.
|Input Collecion||SObject Collection||Collection of Records|
|Record Count||Integer||Number of records to keep|
|Output Collecion||SObject Collection||Collection of Records|
|Return Count||Integer||Number of records returned|
This component is installed with the Collection Actions package version 3.1.0 or later.
4/24/23 – Eric Smith – v1.0