Updates to Dedupe Record Collections Action & ExtractStringsFromCollection Action
Update 5/18/20
The ‘Dedupe Fields From Record Collection‘ action is being retired and the functionality is now being moved into the CollectionsProcessors ‘ExtractFieldsFromCollection’ action:
Ragan Walker added several improvements to the action:
- Parameterizes
dedupeValues
functionality (defaults totrue
) - You can now output to a comma-separated text variable instead of just a text collection variable
- Supports extracting + deduping of multi-select picklist fields
- Adds flow documentation
- Supports bulkification
- Adds exception handling to make action more robust
- Adds further unit testing
You can still download the ‘DedupeRecordsFromCollection’ action below.
Intro
A few months back I posted about an action Danny Tilton and I over at CapTech Consulting worked on that has simplified a ton of my Flows. You can find that on my LinkedIn profile here (sorry, shameless plug: Here)
Code files can be found here https://github.com/alexed1/LightningFlowComponents/tree/master/flow_action_components
New Version Highlights
- We separated the action into two classes: DedupeFieldsFromRecordCollection and DedupeRecordCollection to simplify its usage.
- Added a couple error exceptions – just in case!
- You can now output results from DedupeFieldsFromRecordCollection to a comma-separated text variable (instead of just a collection)!
Dedupe Fields From Record Collection
NOTE: THIS ACTION IS NOW RETIRED IN FAVOR OF REVAMPING THE ‘ExtractStringFromCollection’ action. See the update at the beginning of this post.
Summary
This class takes in a Record Collection and spits out all of the de-duped values of a field of your choosing across the records in the collection.
I used this in my LinkedIn Post, but say you wanted to get a list of all of the Owners of a bunch of records, but you didnt want a bunch of duplicate IDs. Run this bad boy on your collection and you’ll get a collection or text string of unique IDs! You can that loop on that to send an email alert, for example.
Inputs
- Object Type
- InputRecordCollection – The collection you want to get the de-duped field from
- fieldToDedupeOn – The API Name of the unique field values you want to return in your text collection
Outputs
- textCollection – Returns the results in a Text Collection variable
- textString – Returns the results in a comma-separated text variable
Dedupe Record Collection
Installation Link: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t4T000000x9LA
Sandbox Link (recommended): https://test.salesforce.com/packaging/installPackage.apexp?p0=04t4T000000x9LA
Summary
This is quite similar to the other class – instead of the action returning text, it just returns a set of de-duped records based on the field you specify.
In the example above you could de-dupe a set of Accounts based on OwnerId, then loop over each of the Accounts to grab its Owner to email on a nightly schedule. I think where this would come in handy is if you needed to grab other details about the record you’re de-duping on. Let’s say in your email to the Record Owner you wanted to give a few details about the record – that’s where you’d want this action.
Inputs
- Object Type
- inputRecordCollection – The collection you want to de-dupe
- fieldToDedupeOn – The API Name of the unique field values you want to de-dupe all of the records on
Outputs
- Object Type
- outputRecordCollection