Enhance your Flows with Data Tables – Part 1

Lightning Flow Screen Components are a great way to add power to and improve the look of your Flows.  In this three-part series, I’ll show you how a single component, designed to display a list or table, can enhance your Flows.

Alex Edelstein’s 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 Alex’s 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

Part 1: Selecting a Record

When I first built this flow, I used a Record Choice Set (Dynamic Record Choice) in my screen to present a list of records to make a selection from.

A common issue Admins run into with this type of input is that one is restricted to displaying just a single field from the record when presenting the selection.  Like many Admins, I created a new custom field in my object to combine the values of multiple other fields so I could show more information in my selection prompt.

Custom Formula Field for my Record Selection

This type of selection is awkward and you are not able to make the information line up from one record to the next.

Here’s what happens when I replace the Record Choice Selection with a Datatable Flow Screen Component.

See https://unofficialsf.com/datatable for complete information and instructions on this component.

My Flow looks up a collection of records to display in the table and passes that parameter to the component.

Note: Even though you are displaying a table for a single object, parameters are available for 8 standard or custom objects. This is to allow an Admin to easily use this component with no Lightning Component source code customization required.

sObject Collection Variable with records to display in the table

I define the structure of my table by providing field and formatting information for up to 10 columns.

Column Parameters – The first column can display an icon
Column Parameters – Field Name, Label & Type with Width & Alignment

Column Parameters – Only fieldName, label and type are required

When the user clicks Next, the component can pass a collection of the selected records back to the Flow.

Output Parameter – sObject Collection Variable with record(s) selected from the table

Now the user sees a formatted table with a checkbox available to make their selection.

Selecting a record with a datatable

The Flow then uses the values it needs from the selected record to complete its processing.

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.


55 thoughts on “Enhance your Flows with Data Tables – Part 1

  1. This is seriously one of the most helpful posts I’ve ever seen. Brilliant solution for a challenge I’ve been thinking about for years. Thank you for sharing!

    Liked by 1 person

      1. I have the same question. It seems Mobile Flow does not support Record Choice Set.
        When I tested the same flow in my FSL Mobile App, the picklist does not return the correct values…


  2. Thank you for this amazing solution! I just used this in a flow so users can select the open cases they want to update and the table is perfect. Couldn’t have done it without this data table and awesome documentation.


  3. Eric Hi,
    This is an amazing feature!!!
    I can think of so many things I can do with it 🙂

    For some reason, I only get one column filled with data, even though I’ve added more than one column. The rest of the columns shows only the title.

    For testing, I’ve created a Get element that will display all of my Accounts. Afterward, I’ve created a Screen element with the ‘datatableFSC’ component and added the fields “captured” via the Get.

    Am I missing something?

    Thanks a lot,


    1. There could be 2 reasons your other columns are blank.
      1) The fields are not included in your SObject collection variable
      2) The Column Type setting doesn’t match the field type. Type options include text, boolean, currency, date, email, location, number, percent, phone, url


  4. Eric Hi,
    This problem has been solved. Thanks!
    Is there a way to store only one field in the Output, instead of using a Collection?
    I’m trying to ask the users to choose only one record from a list, and then use its ID and update another record.

    Best Regards,


  5. I plan on updating the component to support single record selection. It would still use a collection variable but it would display radio buttons instead of checkboxes. If you want to modify the component in the meantime to support that, you could update a new version of the datatableFSC.cmp file to add maxRowSelection=”1″ to the lightning:datatable parameters.


  6. Hi Eric – First – thank you for the great posts on this topic! I am having a challenge with the datatable component. I have it configured the same way you do for Accounts instead of Cases and when I try to test it, it just spins and never returns the records. Any ideas? I confirmed the component code is correct. Thanks!


  7. This is great but I can’t seem to get the additional columns to display data. My table only has the record but not any text fields I added to Columns 2 and 3. Any ideas?


      1. The collection is Contacts and the Column02_fieldName is MailingStreet, Column02_label = Mailing Street, type = text, width = 130.
        What am I missing or doing wrong? Is this field not within the collection? I thought if the collection is a collection of records I should be able to display fields of those records.


  8. I’m looping through a collection to get individual related Contact records (and capturing the MailingStreet field) and then I’m using an assignment node to add those individual records to a new collection. At that point is there a way to add that field to the collection?


    1. I have worked on this some more and I was able to get the {!colContract} variable working a Variable + Record Data Type with Allow Multiple Values. I am using this to pull a list of Contacts. I have gotten to the point of have the header of the table show but not the data. I am wondering if the selcontact is not correct. Any help to get this working would be greatly appreciated.

      Get job on this component and blog.


      1. There could be 2 reasons your columns are blank.
        1) The fields are not included in your SObject collection variable
        2) The Column Type setting doesn’t match the field type. Type options include text, boolean, currency, date, email, location, number, percent, phone, url


  9. Hi Eric,
    Just downloaded this component, which is a welcome fit for a number of my use cases. Got it to work with the Case object — works like a charm! Nicely done.

    Then I tried with a custom object and ran into a problem. I updated the design and CMP files, changing the 7th entry to my custom object and saving both. When I opened the component in flow, my new custom object fields displayed properly in the Input and Output sections. So I filled in the required data fields and ran the flow. However, only the header of the data table appears.

    I validated my input and output variables — both are record collections tied to the same custom object. I validated that Get Records actually loaded the collection with 7 records. I displayed them separately in the flow to validate that non-null data was in the required fields. I validated that the 2 fields I wanted to display in the table had the right field names (API names) and field types (1st field is Name of type text, 2nd field is Short_Description__c of type text area (which I set to type text).

    Any thoughts re: what I’m doing wrong? Thanks!


      1. Thanks for getting back to me. Yes, I did confirm that the 2 fields were requested in the Get Records component. To test this, I created a Loop to display each of the 7 records and found that the Get Records did retrieve data for Name and Short_Description__c for each record in the collection.


      2. Hi Eric,

        Thank you very much for the offer — I really would like to get this to work. When you say send me a link to the screen shots, is there someplace I need to post the data so as to get a link to send you? Thanks!


      3. Eric,

        I guessed that maybe you meant a link to a WordPress account. So I created one and posted the screen shots as a public post. Let me know if you can’t get to them. Site is dalesflowblog.wordpress.com


      4. I have updated the documentation. There are 2 sections in the datatableFSCController.js file that are commented out. You will need to un-comment those to support custom objects.


    1. Eric,
      I got it to work — no need to look at the files I referenced. Somehow I missed the fact that code in the Controller file was commented out for custom objects. I thought I needed to change only the Component and Design files to reference the custom objects. I’m not a coder, so I stumbled my way through this.

      Anyway, it all works now. Cheers.


  10. Hi Eric,

    I have a question for you. I have successful got the datatable working in my flow. So I am creating a record on a custom object by pulling data from the contact record. The datatable is a list of contact where the record type is Client. This is working correctly. The problem that I am having is that no matter what contact I select in the contact list the first contact is being used to create the record on the custom object. What am I missing?


      1. Hi Eric,

        I am new to Flow. I have a Output Selected Contacts with {!selContact} variable (Record Collection Variable – Type Record and Object is Contact). Do I need anything for Store Output Values?

        I am getting the table to come up properly but clicking the select box for record seems to mean nothing.
        Here are my steps:

        Retrieve Program: data from the Program that the Create Participant Detail Record is attached to. This seem to be working just fine.

        GetContactData: Get Records for the table. Object is Contact – Get all Contact Records. Sort by LastName – Store Contact Records in Record Collection Variable {!colContact6}. Select Contact Fields to Store in Variable: ID, LastName, FirstName, Mailing Address, Mailing City, MobilePhone, Birthdate, Gender__c. This seems to be working just fine.

        Screen element with datatableFSC: Api Name: dtcContact – Columns are coming in just fine. Collection = Contacts is {!colContact6}, Output Selected Contacts with {!selContact} variable (Record Collection Variable – Type Record and Object is Contact). This seem to be working fine, except when a select a contact it doesn’t create that contact as a Participant Detail.

        Get Contact Data to Create Participant Detail: Object is Contact, No Conditions for Filter Contact Records, Not Sorted, How Many Records to Store is All Records, Record Collection Variable is {!selContact}, Select Contact Fields to Store in Variable: School__c, School_District__c, Gender__c, Name, Organization__c, LastName. Successfully found records when debugging.

        Create Participant Detail Record: How Many Records to Create is One, How to Set the Record Fields is Use separate variables, Create A Record of This Object is Participant Detail, Set Fields Values for the Participant Detail:
        Organization__c : Value is {!conOrganization}
        Participant_Name__c: Value is {!conContactID}
        Program__c: Value is {!recordId}
        School_District__c: Value is {!conSchoolDistrict}
        School_c: Value is {!conSchool}
        Gender__c: Value is {!conGender}
        Debug: CREATE RECORDS: Create_Participant_Detail_Record
        Create one Participant_Detail__c record where:
        Organization__c = {!conOrganization} (null)
        Participant_Name__c = {!conContactID} (null)
        Program__c = {!recordId} (a0t6C000000i4njQAA)
        School_District__c = {!conSchoolDistrict} (null)
        School__c = {!conSchool} (null)
        Record was created but only Program Detail was in the Record. No Contact Information.
        Flow Created Participant Detail Record – Version 5 – v44

        I am sure I am doing something wrong with variables but I am not sure what. Any help would be greatly appreciated.


  11. Make sure that the {!selContact} variable is set in the Output Selected Contacts attribute in the “Store Output Values” section of the datatable attribute assignments. With so many attributes available, you have to scroll almost to the end to find the right place.


  12. Hi Eric,

    Thanks so much for this awesome tool. I’m trying to use datatableFSC with the Lead Object as my source. I have a collection of Leads ({!vCollLeadApplicants}) that fit my parameters. I have the datableFSC loading them into a list beautifully. I have a “collection” ({!vSelectedApplication}) variable to store the selected record (Single or Multi-Row Selection is set to 1).

    My problem is the datatableFSC is not passing that selected value into the variable for use elsewhere. I have tried looping through the selected applicants collection to assign those to a single record variable but that is not working either.

    I started out with the changing the code so the LEAD object replaced the Assets object. Then I thought that may be wrong so I changed that back to ASSETS and changed the first custom object to LEAD (and made changes in all other places). That is not working either.

    I’m hoping you can help me figure this out.


    1. If you updated the code, make sure you made changes in both the .cmp and .design file. If you repurposed one of the Custom objects, make sure the getSelectedName code in the Controller.js file has the comments removed where the selectedRows are updated for the custom objects.

      The other thing to check is to make sure you are putting {!vSelectedApplication} in the OUTPUT section of the attributes in your Flow.


  13. Thank you so much for the amazing flow components. I am new to the flows and trying to get some hands on experience setting up the same. I am trying to use datatableFSC for a custom object as my source. This object has two fields (Question Name (Rich text area) , Answer Choices (Picklist)) that I want to display on my screen. I made changes to the code (Component, Controller, Design). I am using get records to query all records from my customobject and storing the records in collection variable ({!VarPDIQuestionCol} and storing variables (Id, Question__c,Answer_Choices__c). On the datatableFSC component , I have populated Collection – PDI questions (Custom Object) with {!VarPDIQuestionCol}, Column Field Name (Question__c) Column Type :Text, Column Width 100. I also added Column Field Name (Answer_Choices__c) Column Type : Text, Column Width 20. I have populated Output selected with {!VarSelQuestion}. No data is getting displayed. I removed the Answer_Choices_c field assuming mismatch datatype, still no data is getting displayed. It display blank set of 7 records with radio button selection. I am sure I am missing something here. Can you please help fixing the display of data and also for Single Select it says to use 1, should I use 2 for Multi-Select ?

    Thanks in advance


      1. As mentioned on my post to keep it simple I am trying to display only two columns and as such I have included these fields(Id, Question__c,Answer_Choices__c) in my get records node.


      1. I’m not sure if Rich Text fields will display. Anything other than 1 will give you Multi-Select.

        Make sure you put {!VarSelQuestion} in the “Store Output Values to Select Variables” section of the component attributes. When you provide a collection for the Output attribute in the Input section, it signifies which record(s) should be pre-selected.

        Liked by 1 person

      2. Eric,
        Does modifying the Column Properties Editable = True will open up the table column for editing the displayed data? Then pass on the selected records to insert into a custom object ? Is it beyond that simple of a change ?


  14. Eric,
    Is it possible to make the columns displayed editable ? I have a use case to display set of records , allow the users to update certain data attributes then insert the records into a different custom object.

    Thanks in advance


  15. Thanks, nice component. What’s the simplest way for me to get a single variable assigned to the selected item (when I set it up to be single select)? It looks like I must use a collection to assign the result, even it’s it’s single. How do I then assign the first item in the collection to another variable?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s