Using Data Table in the Screen Flow — Winter’23 updates❄
5 min readAug 25, 2022
Displaying multiple records on Flow Screen and Deleting the selected ones
Business Use Case
- Here, the business expects that we should build a User Interface where for the given Account record in Salesforce, we should display all Open Cases for the given account record, and multiple records selection should be allowed.
- The business expects to build this using point & click solution, preferably Flows.
- So, in simple terms, allow the business users to select (one or multiple) open cases and selected records should be deleted from the given Account record.
Developing the solution
- 🚩 Salesforce in its latest release Winter’23 has introduced ‘Data Table (Beta)’ Screen Component in Flows which allows to “Select Single/Multiple Records from a Table in a Flow Screen”.
- So, let’s build a Screen flow in Salesforce to achieve this requirement.
- In Salesforce, go to Setup> Flow > New. Optionally, in Winter’23 you have a shortcut added to launch flow from the Setup home page > top right.
- First of all, create a new Input Resource variable to receive the Account recordId (Available for Input: Checked)
- We need all open Cases for the given account. So let’s add a Get Records element to Query on Case object with matching Account Id and Status!= Closed (to fetch only open cases). Give this step a name say: Get All Cases on Account(Get_All_Cases_on_Account)
- In the next steps, we add a new Screen Element to display all open cases which came as output using the above filter criteria on the Case object.
- We achieve this using the newly added Data Table (Beta) screen component.
Configuring the Data Table (Beta) Screen component
- Set Source Collection = Get_All_Cases_on_Account collection variable (from the previous step where we query on Case object)
- Row Selection Mode = Multiple (to allow multiple row selection)
- Under Configure Columns, add all columns one by one which you want to show in the Data Table on UI.
- Under Advanced > Enable Manually assign variables
- Under Store Output Values to Select Variables > Create a new record collection variable {selectedCaseRecordsVar}
- This record collection variable {selectedCaseRecordsVar} would store all the records which are selected by the user from Data Table (cases selection). Click Done once all these actions are completed.
- Now, after the above step, add a new Delete Record element to Delete the selected records in previous steps and store those records in selectedCaseRecordsVar record collection variable.
- Finally, add a confirmation message (use merge fields to make it dynamic) using the Display Text screen component that the selected cases have been deleted.
- Save and Activate the flow. 👨🎤
- You may add another steps/ fault path as needed to make flow performant and user friendly.
Adding Screen Flow to Account Record Page 📄
- Now that our screen flow with Data Table (Beta) is ready. Let’s add a new tab under the Account record page.
- Go to any Account record > ⚙️Gear Icon on Top right > Click Edit page to launch the app builder.
- Create a new tab under [Page> Tab], named ‘Data Tables in Flow (Beta’) to the Account tabs
- Add Flow standard component, select our new flow and pass the recordId input argument. Once done, click Save and return to the account page.
Testing our new Flow 🧪
- Go to any Account record in Salesforce and check the new page > tab added named ‘Data Tables In Flow (Beta)’.
- It would launch our screen flow automatically using {Account.Id} as recordId input variable. Click Next to continue.
- Congratulations🎉🤩⚡Below records are being displayed using the Data Table component in our screen flow: All Open Cases on Account
- For Testing, let’s select any number of Case records for Deletion and click Next.
- In the background, our Flow step Delete records will delete the selected case records. A confirmation screen is shown for the user’s info. Click Finish and we’re done.
- Verify that both (selected) records are Deleted from the account and we’ve only one open case now on the given Account record.
Congratulations🎉⚡This confirms that the ‘Data Table (beta) in the Flow’ is working perfectly.🤩
Developer details:
- Twitter: @sombirsheoran
- LinkedIn : https://www.linkedin.com/in/sombirsheoran
Please reach out to me for any suggestions or feedback. Would love to hear them❤ If you loved this post, please applaud at the end of this post with a 👏