Lightning Flow Screen Components are a great way to add power to and improve the look of your Flows. In this four-part series, I’ll show you how a single component, designed to display a list or table, can enhance your Flows.
This component is derived from the datatable Lightning Base Component. I recently enhanced the base component to be more powerful and Admin friendly.
I will be showing you some examples about how the Datatable component:
- Can be used in place of a Record Choice Set (Dynamic Record Choice) for selecting a record while displaying more than a single field
- Can be used to select multiple records from an object then perform additional actions on them
- Can be used to present your data in an interactive and visually enhanced format
- Can be used to display and inline edit a collection of records
Part 4: Inline Editing
In November of 2019, Kirill Boyarkin, updated this component to support inline editing. Now you can specify individual columns as editable and the changed values will be passed back to your Flow so you can update the object records.
In this example, I created a simple Flow to present a list of Account records with the Annual Revenue column set to editable.
The Get Records node populates an SObject Collection variable with the records and fields I want to display in my datatable.
I pass that collection into the datatableFSC component on my Flow Screen, define the columns I want to display and set the Revenue column to be editable.
This component has a lot of attributes, so make sure you assign any output attributes in the Output Values section. For my output attributes, I select “Manually assign variables (advanced)” and assign my new SObject collection variable to the same Collection – Accounts attribute I used to pass in my records.
NOTE: The output attribute for selected records (Output Selected Accounts) is only used for identifying selected records in the datatable and may not contain the updated values. When you are combining editing and selecting in a single table, use the “Output Selected Accounts” attribute to get the list of selected records and their IDs and use the “Collection – Accounts” attribute to access the edited records.
The final Update Records node in my Flow is to update the Account object with my collection of edited records.
If you Show the checkbox column with your datatable, you will be able to select multiple rows and optionally apply an edit to all of the selected rows.
By default, the component will display Cancel and Save buttons once you start making edits. You can bypass this option by setting the “Show Save and Cancel Buttons?” attribute to False. Any edits will then be automatically saved once you hit the Next button.
Note: If there are a large number of records in the datatable, the Next button will always display at the bottom of the screen, but the user will have to scroll to the end of the table to see the Cancel and Save buttons.
See the complete series on how you can use the datatable Flow Screen Component in your Lightning Flows.
Part 1 – Use a Datatable to present a dynamic choice for record selection in a Flow.
Part 2 – Use a Datatable in a Flow to select and act on a collection of records.
Part 3 – Use a Datatable to display a formatted, interactive table in your Flow.
Part 4 – Use a Datatable to inline edit a group of records.