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

Learn how to capture and process user-selected rows from a Lightning Datatable inside a Salesforce Screen Flow. Step-by-step setup and best practices.

The short answer

This guide explains how to configure a Lightning Datatable in a Salesforce Screen Flow to capture and process user-selected rows. It outlines component configuration, row selection options, and patterns for executing downstream bulk updates without custom Apex.

Key takeaways Bind the Lightning Datatable source collection to a Get Records output and configure the selection property as Single or Multiple to expose selected rows upon screen submission. Pass the datatable Selected Rows collection into subsequent flow screens, loops, Update Records elements, or invocable Apex. Limit fields retrieved in the Get Records element and apply query filters to optimize datatable performance on large record sets. Add a Decision element or screen validation logic to verify the user selected the expected number of rows before proceeding. Execute bulk updates by gathering IDs from the selected rows collection and passing them to a single Update Records element or list-based invocable Apex action.

Learn how to capture and process user-selected rows from a Lightning Datatable inside a Salesforce Screen Flow. This practical guide walks through setup, configuration, and best practices for reliable results.

Lightning Datatable in a Screen Flow lets admins and developers present records visually and accept user selections for further processing. Capturing selected rows inside Flow enables bulk updates, conditional branching, and integrations without writing custom Apex. This guide explains the Flow elements and component settings you need to reliably get selected rows from a datatable.

Background and benefits:

Using a Lightning Datatable inside a Screen Flow improves usability by letting business users pick records directly from the Flow UI. Once captured, the selected rows can be sent to Update Records, Invocable Apex, or external systems. This reduces clicks, prevents errors from manual entry, and streamlines common processes like mass edits, approvals, or record transfers.

  • Create a new Screen Flow (recommended: Auto-Layout disabled for precise placement) and use a Get Records element to fetch the source records you want to display (for example: Contacts, Accounts, or custom objects).
  • 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 column count reasonable for readability on different devices.
  • Enable row selection by setting the Selection property to Single or Multiple depending on your use case. The component will expose the selected rows as a collection when the screen is submitted.
  • To display or use selected rows, add a subsequent Screen (or logic element) and reference the Lightning Datatable's Selected Rows output as the Source Collection for another Datatable or for further processing (Update Records, Loops, or Apex).

Best practices and tips:

  • Only query required fields in Get Records to improve performance and avoid hitting limits.
  • Use paged views or filtered queries to keep the datatable manageable when returning large record sets.
  • Validate selection count if your flow expects a specific number of rows (use Decision element or validation logic on the screen).
  • When updating many records, use bulk-safe patterns: collect ids from selected rows, then perform 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 are consistent.

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 inside a Flow bridges the gap between intuitive UI and automation. Admins can build low-code solutions that let end users select records visually, developers can extend flows with Apex where necessary, and business users benefit from faster, error-resistant processes. The pattern reduces dependency on custom UI code while remaining flexible 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 subsequent flow elements. This output provides the user-selected records as a collection that can be used 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 within the Screen element and set its Selection property to Multiple. When the user submits the screen, the component will output all checked rows as a record collection.

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

Use a bulk-safe pattern by passing the Selected Rows collection directly into a single Update Records element or an invocable Apex method that accepts a list. This avoids individual record updates and improves flow performance.

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