---
sourceDocument: Yokohama Customer Service Management
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/yokohama/customer-service-management

 Release :

    - yokohama

ft:locale :

    - en-US

ft:publication_title :

    - Yokohama Customer Service Management

ft:clusterId :

    - csm

bundleId :

    - csm

workflow :

    - Customer and Industry


---

# Dynamic related record tables

# Dynamic related record tables {#ariaid-title1}

Release version: Yokohama  
Updated January 30, 2025  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 4 minutes to read
Summarize  
![AI sparkle icon](https://servicenow.com/docs/portal-asset/ai-sparkle-icon) Summarized using AI  
This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.  

## Summary of Dynamic related record tables

The Dynamic Related Records feature in ServiceNow enables you to configure and display related records dynamically within the Related Records tab.
This is achieved by using multiple specialized tables that extend thesysmetadatatable to define the context, data definitions, and their relationships.
This functionality helps you tailor related record displays based on specific records or activities, improving data visibility and relevance.
Show full answer Show less  

## Key Components

* **Related Record Context \[snrelatedrecordcontext\]** : Defines when and for which records related records appear. It specifies the source table (such as cases or playbook activities), conditions for execution, and which related record definitions to apply. Key fields include:
  * **Applies to table:** The source record table, e.g., Case or Activity Execution.
  * **Primary and Secondary reference fields:** Fields used by scripted queries to filter related data.
  * **Conditions:** Additional filters on source records.
  * **Inherited:** Option to include tables extending from the source table.
* **Related Record Definition \[snrelatedrecorddefinition\]** : Specifies the types of related data to retrieve, such as SLAs, emails, or case tasks. Each definition includes:
  * **Display label:** Name shown in the Related Records tab filter dropdown.
  * **Queries from:** The table storing the related records.
  * **Primary and Secondary reference tables:** Tables expected in the definition script for filtering.
  * **Script:** Defines how to retrieve records based on context.
  * **Active flag:** Enables the definition for display.
* **Context Related Record Definition \[snm2mcontextrelatedrecorddefn\]** : Links context records to their related record definitions, managing which related record types appear for a given context. Important fields are:
  * **Order:** Controls display order in the Related Records tab filter list.
  * **Active flag:** Enables the linked related record definition for the context.

## Practical Use for ServiceNow Customers

By configuring these tables, you can customize which related records are shown for different record types or playbook activities in your environment. This allows for enhanced contextual awareness and streamlined navigation for users working with complex datasets such as customer service cases or onboarding activities. The ordering and activation controls let you prioritize and enable only relevant related record types, ensuring an intuitive and efficient user experience.  
The dynamic related records feature uses different tables to store context and
definition information.
The following tables support the configuration of the dynamic related records feature. These tables extend the sys_metadata table.

## Related Record Context table {#dynamic-related-record-tables__section_hy5_pjn_cqb}

Records in the Related Record Context \[sn_related_record_context\] table define the context in which related records appear in the Related Records tab. This includes the following information:

* The selected table. You can create context records for source records (such as customer service cases) or playbook activities (such as adding additional members to an onboarding case).
* Additional conditions that apply to the selected table. These conditions determine when the related record definitions for the selected table are executed.
* The related record definitions to execute. These definitions identify the data to be retrieved, such as SLAs or emails.
{#dynamic-related-record-tables__ul_owt_xxh_fqb}  
{#dynamic-related-record-tables__table_qdx_zx4_t4b__entry__2}

| Field | Description |
|-|-|
| Name | The unique name of the context record. |
| Applies to table | The table that stores the record type for the context record. To display related records for a source record, select the table that stores the source record. For example, Case \[sn_customerservice_case\]. To display related records for a playbook activity, select the table that stores the activities: Activity Execution \[sys_pd_activity_context\]. |
| Primary reference field | The primary field from the Applies to table that is passed to the Context Related Record Definition for evaluation. The value is used by the scripted query in the definition. The following data types are supported: * Sys ID * Doc ID * Reference {#dynamic-related-record-tables__ul_rgt_dmh_fqb} |
| Secondary reference field | The secondary field from the Applies to table that is passed to the Context Related Record Definition for evaluation. The value is used by the scripted query in the definition. The following data types are supported: * Sys ID * Doc ID * Reference {#dynamic-related-record-tables__ul_wpv_n2l_gqb} |
| Application | The application to which the context record applies. This is a read-only field. |
| Active | Enables the context record. |
| Inherited | When enabled, the context record also considers tables that extend from the Applies to table. |
| Conditions | Conditions that are applied to the records in the Applies to table. |
[Table 1. Related Record Context table fields]

{#dynamic-related-record-tables__table_qdx_zx4_t4b}

## Related Record Definition table {#dynamic-related-record-tables__section_jld_tjn_cqb}

Records in the Related Record Definition \[sn_related_record_definition\] table identify one type of data to be retrieved, such as active contracts, case tasks, or SLAs. A definition record includes:

* The display label, which appears in the filter dropdown list in the Related Records tab.
* The table to be queried from. For example, the Email \[sys_email\] table.
* If needed, primary and secondary reference tables.
* Scripted conditions that further specify which fields to query from.
{#dynamic-related-record-tables__ul_qjn_rrc_gqb}

You can create definition records for each type of data to include in the Related Records
tab and then associate the definitions with one or more context records.  
{#dynamic-related-record-tables__table_icd_n1p_t4b__entry__2}

| Field | Description |
|-|-|
| Display label | The unique name of the related record definition. This label appears in the filter list in the Related Records tab. |
| Primary reference table | The primary table used in the definition script. At runtime, the script expects to get passed a record of this type. If you entered a data type in the Primary reference field in the related record context, enter the table for that data type. |
| Secondary reference table | The secondary table used in the definition script. At runtime, the script expects to get passed a record of this type. If you entered a data type in the Secondary reference field in the related record context, enter the table for that data type. |
| Application | The application to which the definition record applies. This is a read-only field. |
| Queries from | The table that stores the related record data to be retrieved. |
| Active | Enables the definition record. A definition must be active for the related records of that type to be displayed in the Related Records tab. |
| Script | Create a script that defines which records are retrieved based on the context. |
[Table 2. Related Record Definition table fields]

{#dynamic-related-record-tables__table_icd_n1p_t4b}

## Context Related Record Definition table {#dynamic-related-record-tables__section_ncg_rjn_cqb}

The Context Related Record Definition \[sn_m2m_context_related_record_defn\] table defines
the relationship between a context record and its associated definition records.

When you open a context record, you can see the associated definition records in the
Context Related Record Definitions related list.  
{#dynamic-related-record-tables__table_pbv_m4n_cqb__entry__2}

| Field | Description |
|-|-|
| Related record context | The context record. |
| Related record definition | The name of the related record definition associated with the context record. The system uses this definition to determine which records to retrieve. |
| Application | The application to which the context record applies. This is a read-only field. |
| Order | The order determines where the related record type appears in the filter list in the Related Records tab. The order for this related record definition is compared with the order of the other definitions associated with the Related record context to determine the order of appearance in the filter list. If more than one context applies to a record, the system evaluates the order for all of the related record types. If there is a duplicate related record type, the system takes the record type with the lowest order value. |
| Active | Enables the Related record definition for this context record. |
[Table 3. Context and associated definition records]

{#dynamic-related-record-tables__table_pbv_m4n_cqb}

