Understanding and Using the Document ID Field in ServiceNow
- kelly.ryu
- Mar 20
- 2 min read
Updated: Mar 29

The Document ID field in ServiceNow is a versatile and powerful feature that enables records to dynamically reference other records from various tables. Unlike standard reference fields limited to a specific table, the Document ID field can reference any record across multiple tables by utilizing an associated Table Name field. This flexibility is essential for developing dynamic workflows, approval processes, and automation within the ServiceNow platform.
What is a Document ID Field?
A Document ID field in ServiceNow functions as a dynamic reference field, capable of pointing to records on any table. It requires pairing with a Table Name field, which specifies the exact table where the referenced record resides. Together, these fields allow ServiceNow to uniquely identify and reference the record across diverse tables.
Benefits of Using Document ID Fields:
Multi-table referencing: Reference records from multiple tables with a single field.
Enhanced flexibility: Adapt workflows dynamically based on varying record types.
Simplified management: Manage approvals and audit logs without constraints on table-specific fields.
Step-by-Step Guide: Setting a Value for a Document ID Field
Step 1: Create a Table Name Field
Navigate to the table dictionary where the Document ID field will be used.
Add a new field of type "Table Name" (e.g., u_table). This field stores the name of the table for the referenced record.
Step 2: Configure a Document ID Field
Create another field of type "Document ID" (e.g., u_doc_id) in the same table.
Open the Dictionary entry for your Document ID field and set the dependent field to the newly created Table Name field (u_table).
Step 3: Setting a Document ID Field Value via Script
After configuring these fields, use the following script in ServiceNow to set values dynamically:
current.u_table = 'incident';
current.u_doc_id = 'SYS_ID_OF_RECORD'; // Replace with actual sys_id
current.update();
Alternative Method: Inline Script in Flow Designer
If you are using Flow Designer, you can directly set the Document ID field using an inline script:
return SYS_ID_OF_RECORD; // Replace with actual sys_id
Ensure the Table Name field is appropriately configured and corresponds to the Document ID field to maintain consistency.
Practical Examples
Approval workflows: Use Document ID fields to reference different records undergoing approval (Incident, Change, or Problem).
Audit tracking: Maintain logs that dynamically reference any record type across the platform, streamlining data management.
The Document ID field significantly enhances the capability of ServiceNow applications by providing flexible referencing across multiple tables. Proper configuration with an associated Table Name field and appropriate scripting can greatly streamline your workflows and improve data management efficiency. By leveraging this field, administrators and developers can create robust, adaptable solutions tailored to the evolving needs of their organization.
To maximize the benefit of Document ID fields, consistently follow best practices in field configuration and scripting techniques discussed in this guide.