{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":6684,"path":"customer-service-management/dynamic-related-record-tables.md","title":"Dynamic related record tables","bundle":null,"doc_type":null,"release":"australia","body":"\n# Dynamic related record tables\n\nThe dynamic related records feature uses different tables to store context and definition information.\n\nThe following tables support the configuration of the dynamic related records feature. These tables extend the sys\\_metadata table.\n\n## Related Record Context table\n\nRecords 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:\n\n-   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\\).\n-   Additional conditions that apply to the selected table. These conditions determine when the related record definitions for the selected table are executed.\n-   The related record definitions to execute. These definitions identify the data to be retrieved, such as SLAs or emails.\n\n<table id=\"table_qdx_zx4_t4b\"><thead><tr><th>\n\nField\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nName\n\n</td><td>\n\nThe unique name of the context record.\n\n</td></tr><tr><td>\n\nApplies to table\n\n</td><td>\n\nThe table that stores the record type for the context record.\n\n To display related records for a source record, select the table that stores the source record. For example, Case \\[sn\\_customerservice\\_case\\].\n\n To display related records for a playbook activity, select the table that stores the activities: Activity Execution \\[sys\\_pd\\_activity\\_context\\].\n\n</td></tr><tr><td>\n\nPrimary reference field\n\n</td><td>\n\nThe 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:\n\n-   Sys ID\n-   Doc ID\n-   Reference\n\n</td></tr><tr><td>\n\nSecondary reference field\n\n</td><td>\n\nThe 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:\n\n-   Sys ID\n-   Doc ID\n-   Reference\n\n</td></tr><tr><td>\n\nApplication\n\n</td><td>\n\nThe application to which the context record applies. This is a read-only field.\n\n</td></tr><tr><td>\n\nActive\n\n</td><td>\n\nEnables the context record.\n\n</td></tr><tr><td>\n\nInherited\n\n</td><td>\n\nWhen enabled, the context record also considers tables that extend from the **Applies to table**.\n\n</td></tr><tr><td>\n\nConditions\n\n</td><td>\n\nConditions that are applied to the records in the **Applies to table**.\n\n</td></tr></tbody>\n</table>## Related Record Definition table\n\nRecords 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:\n\n-   The display label, which appears in the filter dropdown list in the Related Records tab.\n-   The table to be queried from. For example, the Email \\[sys\\_email\\] table.\n-   If needed, primary and secondary reference tables.\n-   Scripted conditions that further specify which fields to query from.\n\nYou 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.\n\n<table id=\"table_icd_n1p_t4b\"><thead><tr><th>\n\nField\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nDisplay label\n\n</td><td>\n\nThe unique name of the related record definition. This label appears in the filter list in the Related Records tab.\n\n</td></tr><tr><td>\n\nPrimary reference table\n\n</td><td>\n\nThe 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.\n\n</td></tr><tr><td>\n\nSecondary reference table\n\n</td><td>\n\nThe 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.\n\n</td></tr><tr><td>\n\nApplication\n\n</td><td>\n\nThe application to which the definition record applies. This is a read-only field.\n\n</td></tr><tr><td>\n\nQueries from\n\n</td><td>\n\nThe table that stores the related record data to be retrieved.\n\n</td></tr><tr><td>\n\nActive\n\n</td><td>\n\nEnables the definition record. A definition must be active for the related records of that type to be displayed in the Related Records tab.\n\n</td></tr><tr><td>\n\nScript\n\n</td><td>\n\nCreate a script that defines which records are retrieved based on the context.\n\n</td></tr></tbody>\n</table>## Context Related Record Definition table\n\nThe Context Related Record Definition \\[sn\\_m2m\\_context\\_related\\_record\\_defn\\] table defines the relationship between a context record and its associated definition records.\n\nWhen you open a context record, you can see the associated definition records in the Context Related Record Definitions related list.\n\n<table id=\"table_pbv_m4n_cqb\"><thead><tr><th>\n\nField\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nRelated record context\n\n</td><td>\n\nThe context record.\n\n</td></tr><tr><td>\n\nRelated record definition\n\n</td><td>\n\nThe name of the related record definition associated with the context record. The system uses this definition to determine which records to retrieve.\n\n</td></tr><tr><td>\n\nApplication\n\n</td><td>\n\nThe application to which the context record applies. This is a read-only field.\n\n</td></tr><tr><td>\n\nOrder\n\n</td><td>\n\nThe 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.\n\n 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.\n\n</td></tr><tr><td>\n\nActive\n\n</td><td>\n\nEnables the **Related record definition** for this context record.\n\n</td></tr></tbody>\n</table>"}}