Setting Value for Document ID field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2016 03:56 AM
Hello,
Through scripting I am setting value(sys_id of record from XYZ table) for field of Document ID type while inserting record in that table, not sure how to point the XYZ table so that document ID field will allow to set value, can anybody suggest please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2016 04:00 AM
Can you elaborate more and provide related code...
Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.
Thanks,
Deepa

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2016 04:05 AM
Hi Mangesh,
A document ID field really needs a dependent table field. The two go together. The table field is of type "Table name". See the dictionary entry for sysapproval_approver table's document_id field as an example how this is done.
Reference: Creating a Document ID Field - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2016 04:08 AM
You should define table name before setting value in document id type field.
Write script like :
current.u_table = 'XYZ '; // Write table name of the XYZ table and field name in place of u_table.
current.u_doc_id = "SYS_ID" ;// write sys_id of the record in place of SYS_ID
current.update();
Thanks,
Mihir