Skip to main content
New tool CRON Expression Builder — preview next run times before you schedule Apex. Open the builder →
A visual diagram showing the integration steps for handling selected rows in a Lightning Datatable using Salesforce Flow
Flow

Handle Selected Rows in Lightning Datatable with Salesforce Flow — Step-by-Step Guide

How to capture and process user-selected rows from a Lightning Datatable inside a Salesforce Screen Flow, with the setup steps and the practices that keep it fast.

The short answer

This guide shows how to configure a Lightning Datatable in a Salesforce Screen Flow so it captures and processes user-selected rows. It covers the component settings, the row selection options, and the patterns for running bulk updates downstream without custom Apex.

Key takeaways Bind the datatable's source collection to a Get Records output, then set the selection property to Single or Multiple so the selected rows come out when the screen is submitted. Pass the datatable's Selected Rows collection into later flow screens, loops, Update Records elements, or invocable Apex. Limit the fields the Get Records element retrieves and filter the query to keep the datatable fast on large record sets. Add a Decision element or screen validation to check the user picked the number of rows you expect before the flow moves on. For bulk updates, gather the IDs from the selected rows collection and hand them to one Update Records element or a list-based invocable Apex action.

A Lightning Datatable in a Screen Flow lets admins and developers present records visually and take user selections for further processing. Capturing those selected rows inside Flow gives you bulk updates, conditional branching, and integrations without writing custom Apex. Below are the Flow elements and component settings you need to get selected rows out of a datatable reliably.

Background and benefits:

The usability win is that business users pick records straight from the Flow UI. Once captured, the selected rows can go to Update Records, invocable Apex, or an external system. That cuts clicks and removes the errors manual entry introduces on mass edits, approvals, and record transfers.

  • Create a new Screen Flow (turn Auto-Layout off for precise placement) and use a Get Records element to fetch the source records you want to display, for example Contacts, Accounts, or a custom object.
  • Add a Screen element and drop the Lightning Datatable component onto it. Bind the Data Table's Source Collection to the Get Records output collection so records populate automatically.
  • Define the Table Columns you want users to see (label, fieldName, type). Keep the column count low enough to stay readable on different devices.
  • Turn on row selection by setting the Selection property to Single or Multiple, depending on the use case. The component exposes the selected rows as a collection when the screen is submitted.
  • To display or use the selected rows, add a following Screen (or logic element) and reference the Lightning Datatable's Selected Rows output as the Source Collection for another Datatable, or send it on for further processing (Update Records, Loops, or Apex).

Best practices and tips:

  • Query only the fields you need in Get Records. It helps performance and keeps you away from limits.
  • Use paged views or filtered queries so the datatable stays manageable when the query returns large record sets.
  • Validate the selection count if your flow expects a specific number of rows, with a Decision element or validation logic on the screen.
  • When updating many records, stay bulk-safe: collect ids from the selected rows, then run a single Update Records element or call an invocable Apex that accepts a list.
  • Test with different profiles and devices (desktop vs mobile) to make sure the datatable layout and selection behavior hold up.

Example quick flow pattern:

  • Get Records -> Screen (Datatable to select rows) -> Decision (validate selection) -> Screen (confirmation showing Selected Rows) -> Update Records/Invocable Apex.

Use cases:

  • Mass reassign owners for selected records.
  • Bulk-update status fields for selected opportunities or cases.
  • Trigger follow-up automation for only the user-chosen records (send emails, create tasks).

Why this matters for Salesforce admins, developers, and business users:

Capturing Selected Rows in a Lightning Datatable puts a usable interface in front of your automation. Admins get a low-code way to let end users select records visually, and developers can extend the same flow with Apex where the logic needs it. You depend less on custom UI code without losing room for complex business logic.

#Flow #LightningDatatable #SalesforceFlow #ScreenFlow #Automation

For more, please follow our page!

Frequently asked questions

How do you get selected rows from a datatable in a Salesforce Screen Flow?

Reference the Lightning Datatable component's Selected Rows output variable in later flow elements. It hands you the user-selected records as a collection you can use in screens, Decision elements, Update Records, or invocable Apex.

How do you enable multiple row selection in a Flow Datatable?

Select the Lightning Datatable component inside the Screen element and set its Selection property to Multiple. When the user submits the screen, the component outputs every checked row as a record collection.

What is the best practice for updating records selected in a Flow Datatable?

Use a bulk-safe pattern: pass the Selected Rows collection straight into one Update Records element, or into an invocable Apex method that accepts a list. That keeps you off record-by-record updates and the flow runs faster.

Newsletter

One email every Tuesday

New guides, tool updates, and the release-note changes that break things.

No spam. Unsubscribe in one click.

Comments

Loading comments...

Leave a Comment