Let’s Revisit How to use both the Selected and the Edited records in a Datatable
This content demonstrates how to efficiently combine selected and edited record collections returned from a Datatable Flow Screen component in Salesforce. It addresses the challenge of merging original selected records with user edits without needing loops or custom Apex by leveraging the Get Common and Uncommon Records Flow Action. Salesforce professionals can apply this pattern to streamline their Flows that require working with both selections and edits, improving data handling in automated processes. Ultimately, it simplifies managing edited records within selections in declarative automation.
- Use the Get Common and Uncommon Records action to compare two record collections by Id.
- Combine Source Unique (selected-only) and Target Common (edited & selected) collections to merge edits into selections.
- Avoid loops by using assignment to merge record collections in Flow.
- Datatable v4.3.0 outputs edited records separately, allowing easier processing.
- Create a Record Collection variable to store combined selected and edited records.
Starting with v4.3.0 of Datatable, the output attribute Output Remaining Rows will include all records in the Datatable with all saved edits applied. There is no more need to add extra processing to the flow to combine the edited records with the original records. A year ago, I showed you how you can use a Flow with a Loop and a special Apex action to update the Selected records from the Datatable component with the Edited records from the same Datatable. Now I’m going to show you how you can get rid of the Loop and use a different action and a simple assignment to produce the same results. My Datatable Flow Screen Component allows a user to both Select records and make Edits to records. The component returns two separate collection variables. One of them includes the original values of just the Selected records. The other one includes just the Edited records whether they were selected or not.