How to develop Lightning DataTable for Salesforce flows

on

|

views

and

comments

Hello #Trailblazers,

Welcome back to SFDCPanther and wish you a very happy new year 2022.

In this blog post, we will learn how to develop a lightning datatable for Salesforce Lightning Flow Builder.

 

We know that we can not directly develop the Lightning DataTable for Salesforce flow. So I have developed a lightning web component that can be used inside a flow and will work dynamically for any object.

The Lightning DataTable has the below features which can be developed for any flow

  1. Display List of Records for Any object with the mentioned fields.
  2. Ability to make the fields HyperLink
  3. You can also select max no of records in flow and get the selected records back to flow
  4. You can filter the records based on parent record
  5. Pagination to display the records

Outcome of the flow

Installation

You can install the package in your org from the following links

For Production or Developer Orghttps://login.salesforce.com/packaging/installPackage.apexp?p0=04t0o000003bSZl

For Sandbox Orghttps://test.salesforce.com/packaging/installPackage.apexp?p0=04t0o000003bSZl

 

Steps to Configure the DataTable

After installing the package. You need to create a screen flow where you can use a data table.

  1. Go to Setup
  2. From Quick Search box search for Flows
  3. Select Flows under Process Automation
  4. Click on New Flow
  5. Select Screen Flow from the Popup
  1. Click on + icon and Select Screen

From Components Tab Search for DataTable Component

From the right hand side Select the Object under which you wanted to create the datatable

Provide the values for the no of records you wanted to query, no of records to display on table, and the maximum no of records to be selected from the data table

Scroll down to below a little bit and provide the necessary values for the other required fields

  1. Table header fields – All the fields which you wanted to display in datatable comma separated. For Example – CaseNumber, Subject, Account.Name, ContactId
  2. The Object API Name to display the records – It will be auto populated from the object you selected in first step.
  3. The Sort Direction – How you wanted to sort the records. Valid values are DESC and ASC
  4. Display Link – The list of comma separate fields where you wanted to put the hyper link
  5. Field API Name to Filter the Records – The Field API name on the Query object by which you wanted to filter. For Example Contact Id
  6. Id to Filter the Records – The value by which you wanted to filter the records.

Save and debug the flow

As you can see we have got all the case records within the pagination.

Now, if you want to get the selected record information. You can use the below variable

  1. firstSelectedRecord – This variable will give you the first selected record
  2. allSelectedRecords – This variable will give you all the selected records if you have selected multiple records

 

Below is an additional screen which I have added to display the selected case record Case Number

Below is the screen where we have selected one case record

And below is the screenshot for the selected record.

Final Outcome

Thanks for reading 🙂

Please let us know your thoughts in the comment section

Amit Singh
Amit Singhhttps://www.pantherschools.com/
Amit Singh aka @sfdcpanther/pantherschools, a Salesforce Technical Architect, Consultant with over 8+ years of experience in Salesforce technology. 21x Certified. Blogger, Speaker, and Instructor. DevSecOps Champion
Share this

Leave a review

Excellent

SUBSCRIBE-US

Book a 1:1 Call

Must-read

How to start your AI Journey?

Table of Contents Introduction Are you tired of the same old world? Do you dream of painting landscapes with your code, composing symphonies with data, or...

The Secret Weapon: Prompt Engineering: 🪄

Table of Contents Introduction Crafting the perfect prompt is like whispering secret instructions to your AI muse. But there's no one-size-fits-all approach! Exploring different types of...

How to Singup for your own Production org?

Let's see how we can have our salesforce enterprise Salesforce Org for a 30-day Trial and use it as a Production environment. With the...

Recent articles

More like this

13 COMMENTS

  1. Hi this is amazing, just 2 points, is this support inline edit? and is this support both row level action and multi select action ? Thanks.

  2. Hey, Thanks Amit for this amazing articles. Just wondering about one point: is the selected records get lost over pagination ? If we select records from differents pages, just the selected record from the last page is retrieved.

  3. Hi Amit, thanks for sharing the post !!
    I’m not able to find the latest version (fix for custom fields), can you pls guide me with the latest version download pls.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

5/5

Stuck in coding limbo?

Our courses unlock your tech potential