Dynamic related record tables

reference australia Updated Sep 10, 2026 4 min read dynamic-related-record-tables.md
Raw file servicenow.com

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.

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.

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

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

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.

## Related Record Definition table

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.

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.

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.

## Context Related Record Definition table

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.

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.

Search documentation
Search document titles and file paths on the australia branch