Enhance your Flows with Data Tables – Part 4 (Inline Editing)

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.

The unofficialsf.com website includes datatableFSC as one of many Flow Screen Components you can use for your own organization.

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.


0 0 vote
Article Rating
Subscribe
Notify of
guest
23 Comments
Inline Feedbacks
View all comments
Michael Pierce
5 months ago

I love this component! It’s a game changer, and I love the ability to edit. However, what type would I select for a picklist? If use text, the field is rendered as text and the Salesforce picklist values are not shown. Is this a limitation of the component?

travadactal
3 months ago

I absolutely love this product! I have on question I’m hoping you can help with. In my flow I’m using the selected Custom Object records to create cases. At the end of the flow, I want to display the created case numbers to the user – however, the case number is blank from the screen. I notice that the data types listed on the document doesn’t state Auto Number – is that why the created case numbers aren’t showing? Is there a workaround, if so?

travadactal
3 months ago
Reply to  Eric Smith

I tried that, but it was still blank. Create Case > Loop Through created cases > Get Created Cases > Assign to new collection > Use new collection in the final screen to display the case numbers.

Does that sound right?

travadactal
3 months ago
Reply to  travadactal

Disregard – I had my record variables incorrect in my last collection. Works as it should! Thanks again for such an amazing product!

travadactal
3 months ago
Reply to  Eric Smith

Hi Eric. One more question. If I want to display the Contact Owner’s name, instead of the Id – is there a way to achieve this outside of creating a new formula field in the Contact object?

charlie
charlie
3 months ago

Hello Eric,

I’m sure I’m not commenting in the correct area, however I attempted to review GitHub and several other areas on unofficialsf.com however not sure if there’s a form area to ask questions.

I’ve installed the package into production and have read the beginning supporting document however I cannot find where or how to change the Javascript coding as I am in need to create a data table with Opportunity Line Items. Can you please direct me to an area for assistance?

Many thanks!

travadactal
3 months ago

Hi again Eric. I built a flow that is launched via button on a case page layout. When I run this as an admin, I have no issues. If I log in as another user, however, I get the following error: This page has an error. You might just need to refresh it. Error in $A.getCallback() [[object Object]] Callback failed: serviceComponent://ui.interaction.runtime.components.controllers.FlowRuntimeController/ACTION$runInterview Failing descriptor: {markup://flowruntime:flowRuntimeV1} I don’t have lightning enabled for the whole org, but even if I enable it for this profile, I get the same error. Any ideas what may be the issue? Loading...

Eric Smith
3 months ago
Reply to  travadactal

This probably means that the running user does not have access to one of the standard objects included in the component. You will need to change or comment out the references to that object in the component code.

Chris Van Der Merwe has written a nice blog post on how to modify the component here:
https://www.professorflow.com/post/lightning-datatable

Filip Poverud
Filip Poverud
2 months ago

Hi, excellent component. However, I’m not able to save anything. Here’s what I do:

Create a Variable colMysObject as a Record with Multiple
Create a Variable colMysObjectSelected as a Record with Multiple
Create a Variable colMysObjectSelectes as a Record with Multiple

And I follow your guide, but there are several places with collection/output in the component and I have tried different combinations but simply not able to save the edited values.

Anonymous
Anonymous
2 months ago
Reply to  Filip Poverud

Last Variable is colMysObjectEdited
I also have to mention that this is Create new records, so in order to create the lightning table I use a Loop to assign default values to my colMysObject collection and I avoid assigning the Id because Create will fail if Id is set.

SHawna Richardson
SHawna Richardson
1 month ago

Is there a way to limit the number of rows shown on the screen? i have it showing all contacts assoc with an account, but some of our accounts have 400+ contacts

saira
saira
1 month ago

Has anyone experienced this not working in Internet Explorer. My flow is failing because i am using this component. It works fine in chrome

Juul
Juul
1 month ago

Hi Eric, I’ve just installed the DATATABLE – LIGHTNING WEB COMPONENT FOR FLOW SCREENS. And used already for several business cases. Really great work! Can you tell me if editing of lookup fields is in the backlog? Thanks!