- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2019 07:45 AM
What is document ID field Type ? I want to set a value to a document ID field using script, Is it possible?
Need help urgently.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2019 07:47 AM
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.
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
Abhishek Gardade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2019 07:47 AM
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.
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
Abhishek Gardade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2019 07:50 AM
Check out this HI ticket as well:
https://hi.service-now.com/kb_view.do?sysparm_article=KB0547763
Thanks,
Abhishek
Abhishek Gardade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 10:46 PM
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