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!
Leave a Reply