Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

What is document ID field Type ? How to set a value to a document ID field using script

Savita P
Tera Contributor

What is document ID field Type ? I want to set a value to a document ID field using script, Is it possible?

find_real_file.png

Need help urgently.

1 ACCEPTED SOLUTION

AbhishekGardade
Giga Sage

Hello Hit,

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.

find_real_file.png

Document ID:

You can create document ID fields to reference any record on any table.

A sys_id is useless without a knowing what table the record resides on.
Alas, a Document ID field needs to be coupled with a Table Name field.
First you will need to create a 'Table Name' field (let's say 'u_table').
Once you have done that,open the Dictionary entry of your Document ID field and set the dependent field to 'u_table'.

Then you can write the following code


current.u_table = 'incident';
current.u_doc_id = SYS_ID;
current.update();

Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade

Thank you,
Abhishek Gardade

View solution in original post

3 REPLIES 3

AbhishekGardade
Giga Sage

Hello Hit,

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.

find_real_file.png

Document ID:

You can create document ID fields to reference any record on any table.

A sys_id is useless without a knowing what table the record resides on.
Alas, a Document ID field needs to be coupled with a Table Name field.
First you will need to create a 'Table Name' field (let's say 'u_table').
Once you have done that,open the Dictionary entry of your Document ID field and set the dependent field to 'u_table'.

Then you can write the following code


current.u_table = 'incident';
current.u_doc_id = SYS_ID;
current.update();

Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade

Thank you,
Abhishek Gardade

Check out this HI ticket as well:

https://hi.service-now.com/kb_view.do?sysparm_article=KB0547763

Thanks,

Abhishek

Thank you,
Abhishek Gardade

Hi Abhishek. 

 

in case, i want to set the value via inline script in Flow designer can i directly return "incident+SYS_ID" in the Doc ID reference field ? 

 

Regards, 


Varun Sharma