> For the complete documentation index, see [llms.txt](https://docs.avonnicomponents.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/tree-grid/open-a-nested-record.md).

# Open a record from a nested row

Add a Tree Grid row action that opens the clicked contact or case in Salesforce while the grid keeps a separate selection for review.

A service agent can browse accounts, contacts, and cases in a Tree Grid and open the exact record they need. Add an **Open record** action that follows the row where the menu was opened. A checkbox selection elsewhere in the grid can stay independent of the action.

<figure><img src="https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2FlIZEyKIC1yxYhhLvMRIJ%2Fopen-a-nested-record-result.png?alt=media" alt="The Salesforce Case record opened from the row action, showing case number 00011457 and linked contact Maya Chen." width="640"><figcaption><p>The row action opens case 00011457 for Maya Chen.</p></figcaption></figure>

## Before you start

* Use the query-backed Tree Grid from [Browse accounts, contacts and cases](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/tree-grid/browse-accounts-contacts-and-cases.md). The example uses Maya Chen and the open Pump inspection case beneath her contact row.
* Work on a Lightning page in Salesforce and make sure your test user can view the contact and case.

## Steps

{% stepper %}
{% step %}

### Add a row action

1. Select the Tree Grid in Component Builder. Open **Properties** and go to **Data Mappings**.
2. Under **Columns**, add a **Custom** column. Turn on **Custom Label** and enter `Actions` in **Label**. Use `recordActions` for the column **Name**.
3. Set **Type** to **Action**. Under **Type Attributes**, add an item in **Row Actions**. Set **Label** to `Open record` and use `openRecord` for its **Name**.

<figure><img src="https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2FdhhBjbL3ccGjF0UffigH%2Fopen-a-nested-record-column.png?alt=media" alt="Action column settings with the Open record row action" width="320"><figcaption><p>Add Open record under Row Actions for the custom column.</p></figcaption></figure>
{% endstep %}

{% step %}

### Navigate using the clicked record ID

1. Open **Interactions** and add an action under **Row Action Click**. Set **Target Name** to **Open record**.
2. Select **Navigate**. Set **Page Reference Type** to **Record Page** and **Action Name** to **View**.
3. In **Record Id**, select **Record: Id**. This uses the ID of the row where the action was clicked.
4. Leave **Object Api Name** blank. Lightning Experience can resolve the record's object from its ID, so the same action can open rows from different objects.

<figure><img src="https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2FognYl9FEq3zPvY5vdOp3%2Fopen-a-nested-record-mapping.png?alt=media" alt="Row action navigation settings showing the clicked record ID mapping" width="320"><figcaption><p>The navigation action reads the ID of the clicked row's record.</p></figcaption></figure>
{% endstep %}

{% step %}

### Save and test two record types

1. Under **Content**, leave **Hide Checkbox Column** off. Save and activate the component version, then open the Lightning page that hosts it.
2. Expand Alder North Field. With a different row checked, open Maya Chen's row menu and choose **Open record**. Confirm that Salesforce opens the Maya Chen contact and compare its record ID with the contact you used to set up the tutorial.
3. Return to the grid. Expand Maya Chen and choose **Open record** on Pump inspection. Confirm that Salesforce opens the case with the expected case number and record ID.
   {% endstep %}
   {% endstepper %}

## Troubleshooting

<details>

<summary>The menu item is missing or does nothing</summary>

Check that you added **Open record** under the Action column's **Row Actions**. In **Row Action Click**, confirm that **Target Name** points to the same item.

</details>

<details>

<summary>The wrong record opens</summary>

Check the **Record Id** mapping. The clicked record's `Id` comes from the row action. An Account lookup on a contact points to its parent account. A Tree Grid selection refers to the checked rows.

</details>

## Related tutorials

* [Browse accounts, contacts and cases](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/tree-grid/browse-accounts-contacts-and-cases.md) to set up the nested records used in this example.
* [Pass selected Tree Grid rows to a Screen Flow](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/tree-grid/pass-selected-rows-to-a-screen-flow.md) to work with checkbox selections across branches.
* [Tree Grid reference](https://docs.avonnicomponents.com/dynamic-components/components/tree-grid.md) for column settings and interaction outputs.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.avonnicomponents.com/dynamic-components/tutorials/components/tree-grid/open-a-nested-record.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
