Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Show an account hierarchy

Show the whole customer group around the account the user is on, parent and subsidiaries, in a screen flow Tree Grid built from one query.

An account manager opens Meridian Chicago Hub and wants to know where it sits in the customer group: which company it reports to, which sister hubs exist, how much revenue each one brings. With the Tree Grid in Hierarchy mode, a screen flow on the Account page shows the whole group from the top, with the branch down to Meridian Chicago Hub already open and its row marked.

A Tree Grid in a screen flow showing the Meridian Group account hierarchy opened down to Meridian Chicago Hub, which is marked as the current record, with a count in brackets beside each parent row and type, city, employees and annual revenue columns
Opened from Meridian Chicago Hub: the whole group, with the branch down to it already open and a count beside each parent.

Before you start

  • Your accounts use the standard Parent Account field, so each subsidiary points at its parent.

  • Your screen flow has a recordId input variable (Text, available for input) and runs on the Account record page with Pass record ID into this variable checked. If not, follow How to pass your current RecordID in your screen flow.

  • Avonni Flow Components is installed in your org.

Steps

1

Add the Tree Grid to a screen

  1. In Flow Builder, add a Screen element and drag the Avonni Tree Grid onto it.

  2. Select it and click Open Component Builder.

  3. In the Header group of the Properties tab, set Title to Customer group.

  4. Turn on Show Number of Children, in the same tab, so each parent row shows how many companies sit below it.

2

Query the Account object

  1. Open the Data Source section of the Properties tab, just above Data Mappings, and choose Query.

  2. Set Object API Name to Account.

  3. Under Order By, add Account Name, ascending, so sister companies read in alphabetical order.

Leave Filters empty for now. In this mode they apply at every level of the hierarchy, so a filter on the top account also hides subsidiaries that do not match it.

3

Switch the query to Hierarchy mode

  1. In the query editor, set Mode to Hierarchy.

  2. Set Parent Lookup Field to Parent Account ID.

There is no level to add: with the lookup chosen, the grid reads parents and children from the same object, as deep as the hierarchy goes. The list only offers lookups from Account to Account.

The Tree Grid query editor in Flow Builder with Mode set to Hierarchy and the Parent Lookup Field set to Parent Account ID
Hierarchy mode on Account. One lookup to itself replaces the levels.
4

Give the grid the account the user is on

  1. In the Properties tab, open the Hierarchy group. It sits between No Results Message and Data Source.

  2. Map Current Record ID to your flow's recordId variable (the picker shows it as Record Id).

The grid climbs from that account to the top of its group, then opens the branch back down to it. Without a value it shows no rows at all.

The Hierarchy group of the Tree Grid Properties tab in Flow Builder, with Current Record ID mapped to the recordId flow variable
Current Record ID takes the flow's recordId.
5

Choose the columns

Under Data Mappings, add one entry per column, all on Account:

Source Field
Type
Why

Account Name

Text

First column: it carries the toggles and the tree.

Account Type

Text

Direct customer or channel.

Billing City

Text

Where each company sits.

Employees

Number

Size at a glance.

Annual Revenue

Currency

Compare the companies of the group.

For the two number columns, open Cell Attributes and set Alignment to right, so the figures line up.

6

Save and test

  1. Save and activate the flow.

  2. Open Meridian Chicago Hub (or any account with a parent) and run the flow from its page.

You see Meridian Group as the only top row. Its branch is open down to Meridian North America, then Meridian US Logistics, then Meridian Chicago Hub, which carries a grey current badge. Meridian Atlanta Hub and Meridian Dallas Hub sit beside it. Meridian Europe stays closed until the user opens it; Meridian Asia Pacific has no subsidiaries, so it has no toggle.

With Show Number of Children on, each parent row carries a count in brackets: Meridian Group reads (10), and the three branches below it read Meridian Europe (2), Meridian North America (5) and Meridian US Logistics (3). In Hierarchy mode that count covers the row's whole subtree, not only the companies directly under it.

To test from Flow Builder instead, see Test a screen flow that needs a record Id.

To show a group's contacts and cases as well, you need several objects, which Hierarchy mode does not read. Use Multi-Level instead: Browse accounts, contacts and cases.

Troubleshooting

The grid is empty on the record page, with no error

Current Record ID has no value at runtime. The flow is not receiving recordId: check Pass record ID into this variable on the Flow component in Lightning App Builder, and the variable name (recordId, exactly). In the Component Builder preview the same situation shows "Hierarchy mode requires both a parent lookup field and record ID."

"Hierarchy mode requires both a parent lookup field and record ID."

The preview has no Parent Lookup Field or no Current Record ID to start from. Pick Parent Account ID in the query editor, and give the preview a record. Or set Mode back to Multi-Level if you did not mean to use a hierarchy.

Only one account shows, with no toggle

The account has no parent and no subsidiary, so its group is itself. Try an account whose Parent Account is filled.

Some subsidiaries are missing

A condition under Filters applies to every level. An account that does not match it is left out, even deep in the tree. Remove the filter or widen it.

I tried a filter on Parent Account ID instead

A filter such as Parent Account ID Equals {!recordId} returns one level: the direct subsidiaries, with no parent above them and nothing below. Current Record ID in Hierarchy mode is the setting that builds the whole tree.

Last updated

Was this helpful?