In this blog we will learn how we can use a very powerful component in the Screen Flows that is "DATA TABLE".
With the help of data table we can show our users/customers list of records.
It can be list of any record collection or you can say list of any Salesforce Object.
Not only that, you can convert this data table to Single or Multi Select picklist as well.

In today's example we will learn :
  1. Show list of accounts to users.
  2. Let user select single account from the list.
  3. Let user select multiple account from the list (multi select picklist).
  4. How to store values when user will come from next screen to previous screen.
  5. How to refresh data table when user will come from next screen to previous screen.
For this let's create a Screen Flow first.
After that for showing the list of Accounts we will need to get the list of accounts from the database.
For that we will take a Get Record Element and get all the Accounts from the database.

Have a look :

After that we will create 2 variables. One will be record variable to select the first selected value from the datatable.
Second will be record collection variable to save all the selected rows from the datatable.

have a look :

Now, we will take a screen element to show the Data Table Component.
In screen element on left hand side you will see data table. Drag it into the canvas.

After that let's take a look at the data table properties.

First mode is View Only. With this you can show the user list of records.
Here you just need to add the source collection. In our case the source collection is our Get Record Element.
We have one more option here to choose which columns we want to show.
I have selected these columns.

And I have saved the flow and added it into a Lightning App.
Here is the output :

Now, let's go back to our flow and make it a Single Select List.
Now, We will choose the select option.

Here, we have chosen "Single". With single there comes one more option which is if you want to make it required. Which means if you check this checkbox then user will not be able to go to the next screen without selecting a value from the list.

Have a look at the output :

Have a look at the error as well. I clicked on the next button without selecting any account and it shows this error. "Please select minimum 1 rows".

See how easy this was right.
Now, let's go back and try making it a multi select picklist.

When you select multiple it ask you what should be the minimum and maximum rows count.
That means what is the least number of rows you want user to select and what is the maximum number of rows.
I have added 1 and 5 here.
After I will select 5 rows all the others rows will be disabled.

Here is the output :

Now, Do you remember in the starting we created 2 variable to store values. Let's see from where we can store them.
So, In data table we have 2 values. 
  1. First Selected Row.
  2. All Selected Rows.
For first selected row we will use our record variable.
For All selected rows we will use our record collection variable.
We can then use these variable to do any dml or any other commits.

here is where you will add these variables.
click on the Manually Assign Variables and fill these up.

Now, let's go back we have one more option left. With the help of that option we can decide if we want to save the values when user comes back or if we want to refresh the datatable.

So, If you want to save the values when user will click next and then comes to previous screen then what you have to do.
In the Advanced section we have an option "Revisit Screen Values" here select the option "Use values from when the user last visited the screen".

After that we will add the default selection and in the default selection we will add our record collection variable.

Now when the user will come back all the rows will be selected.

If you want the datatable to be refreshed select the second option in the Advance section which is "Refresh inputs to incorporate changes elsewhere in the flow".

Also with that, remove value from Default Selection and make it blank.
That's it! Now your datatable will be refreshed.


  • The Data Table flow screen component isn't compatible with mobile devices.
  • If you use the Get Records flow element to retrieve the records to display in the Data Table, select Choose fields and let Salesforce do the rest for the best performance.
  • The maximum number of rows that a Data Table can display is 200.
  • The maximum height of a Data Table is 400 pixels.
  • If a Data Table includes a formula field and records or updates to records that haven't been committed to the database, the table doesn't evaluate the formula properly.

    For records that don't exist in the database, update the value of the formula field with an assignment using a static value or Formula resource. Doing so doesn't affect any subsequent Create or Update operations in the flow.

    For existing records that have been updated, use an invocable action to reevaluate the formula, or use the IN operator to refresh the records and formula field values.

  • If you include a lookup or master-detail relationship field in a Data Table, the table doesn't display the field value. For example, a Data Table can't display the Name field of a related record. To display field values ​​from related records, use object formula fields. You can also use object formula fields to link to related record fields, for example:

    HYPERLINK( "/" & CASESAFEID(Id), Related_Record__r.Name, "_self" )

  • The Data Table component displays Date, Time, and Date/Time fields in UTC or Universal Time Coordinated time. To format a Date, Time, or Date/Time field in the user's locale, add a custom formula field on the object that calls the TEXT() function on the Date, Time, or Date/Time field.

If you wish to checkout more details then please visit this document by salesforce - Click Here

That's it for this blog. 
Hope you found this useful.
If you want to learn with a video tutorial, here is the link :

If you have any question please leave a comment below.

If you would like to add something to this post please leave a comment below.
Share this blog with your friends if you find it helpful somehow !

Let's learn and grow together.
Love and Peace! 

Post a Comment