> ## Documentation Index
> Fetch the complete documentation index at: https://coconut-grid.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Related Grid

A Related Grid displays records based on rows in another Grid or Related Grid in the same item. For example, an Accounts grid can supply the account IDs used to display related contacts.

## How Records Are Matched

The relationship compares a **Source Key** with a **Related Key** on the related object.

* **Standard** uses an existing Salesforce lookup or master-detail relationship. The source key is the source record's `Id`.
* **Custom** compares fields you choose, even when no Salesforce relationship connects the objects. The fields must have compatible types.

For example, a custom relationship can compare `Account.AccountNumber` with `Order.CustomerCode__c`. Matching uses equality, not a partial text search. Source keys use saved Salesforce values and do not need to be visible columns.

## Choose Source Rows

| Source Rows | Records Used |
| - | - |
| **Focused Row** | The row containing the focused cell. Arrow keys follow focus; a dragged cell selection uses its starting row. This is the default. |
| **Selected Rows** | Loaded rows selected with checkboxes. Rows unchecked after selecting all are excluded. |
| **All Loaded Rows** | All saved rows currently loaded in the source grid, including additional pages as they load. Unloaded records are not fetched. |

New unsaved rows are excluded. Duplicate source keys are combined and empty source keys are ignored.

## Choose a Match Type

* **Matching** displays records whose related key equals any usable source key. This is the default.
* **Non-matching** displays records whose related key equals none of the source keys, including records with an empty related key.

If there are no usable source keys, both match types return no records. The related grid's own filters and search settings further restrict the results.

## Work with Related Records

Configure columns, filters, sorting, formatting, and actions as you would for a [Grid](https://coconut-grid.mintlify.site/visualization/grid/overview.md). These settings belong to the Related Grid tab.

The grid reloads when its chosen source rows change. Current rows remain visible while replacement data loads. A hidden related tab loads the latest source rows when you open it.

Place the source and related tabs in separate [layout areas](https://coconut-grid.mintlify.site/visualization/items.md#item-layouts) to see them together. See [Set Up a Related Grid](https://coconut-grid.mintlify.site/visualization/related-grid/setup.md) for configuration steps.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.