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