Work with selected rows
Let an account manager tick accounts in a screen flow Tree Grid, then hand those accounts and their open cases to a colleague after Next.
An account manager hands part of a customer group to a colleague. On a flow screen they open the group's hierarchy, tick the subsidiaries that change hands, and click Next. The flow then reassigns those accounts, and their open cases with them, in one pass.

Before you start
A screen flow whose first screen holds a Tree Grid showing the customer group's accounts, with the Query data source. Show an account hierarchy sets it up.
The examples use the API Name
AccountTree. Replace it with yours in every reference.With the Query source the grid keys every row on the record
Id, so the key outputs below return Account Ids.
Steps
Keep the checkboxes on
Select the Tree Grid on the screen and click Open Component Builder. In the Properties tab:
Leave Hide Checkbox Column off. When it is on, users cannot tick rows and every selection output stays empty.
Turn on Show Number of Items Selected so the user sees how many accounts are ticked ("2 items selected", with a Clear selection link).
Ticking a parent row does not tick its subsidiaries: each account to hand over is ticked on its own.
The Tree Grid has no setting that makes a selection required or caps it. The third step makes it required in the flow.
Pick the output you need
Every element after the screen can read the selection, through five outputs:
Selected Rows
{!AccountTree.selectedRows}
The ticked records, for a Loop or an Update Records
Selected Rows Key Field Value
{!AccountTree.selectedRowsKeyValue}
The Ids as a text collection, for a Get Records with the In operator
Selected Rows Key Field Value comma separated
{!AccountTree.selectedRowsKeyValueCommaSeparated}
One string, 'id1','id2', the shape a SOQL IN (...) clause expects in an Apex action
Selected Rows Key Field Value semi colon separated
{!AccountTree.selectedRowsKeyValueSemiColonSeparated}
One string, id1;id2, unquoted
Selected Rows Serialized
{!AccountTree.selectedRowsSerialized}
The ticked rows as a JSON string, for an action that parses JSON
This flow uses the first two.
Stop when nothing is ticked
After the screen, add an Assignment. Create a Number variable
SelectedCountand set it with Equals Count{!AccountTree.selectedRowsKeyValue}.Add a Decision with an outcome
Accounts ticked:{!SelectedCount}Greater Than0.On the default outcome, add a screen that says "Tick at least one account", then connect it back to the Tree Grid screen.
Reassign the ticked accounts
Add a Loop over
{!AccountTree.selectedRows}, namedLoop_Accounts.Inside the loop, an Assignment:
{!Loop_Accounts.OwnerId}Equals{!New_Owner.recordId}, then Add{!Loop_Accounts}to a new Account record collection variable,AccountsToUpdate.After the loop (After Last Item), one Update Records on
{!AccountsToUpdate}.
Updating once after the loop keeps the flow to a single database update, however many accounts were ticked.

Move their open cases too
The cases do not sit in the grid, so fetch them from the Ids:
Add a Get Records on Case, with two conditions: AccountId In
{!AccountTree.selectedRowsKeyValue}, and IsClosed EqualsFalse. Store all records.Loop over the cases the same way as in the previous step: set
OwnerIdto{!New_Owner.recordId}, add each case to a Case record collection, then one Update Records after the loop.
In takes the text collection as it is. The comma separated string does not work there: it is a single text value.
Save and test
Run the flow with Debug. Click Next with nothing ticked: the message screen appears, then the grid again. Under Meridian Group, tick two regional companies, Meridian Europe and Meridian Asia Pacific, and the grid reads 2 items selected. Click Next, pick a user in New account manager and finish. Both accounts, and every open case on them, now show that user as owner.
Troubleshooting
Related tutorials
Show an account hierarchy: build the grid this flow reads from.
Add row and header actions: act on one row, or on the ticked rows, without leaving the screen.
Tree Grid: every selection setting and output variable.
Was this helpful?
