- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2018 12:12 PM
Hi,
We're creating a profile(GRC module) from our custom table. While creating a record in profile table using scripts, "applies_to" field(document_id data-type) is not getting populated if I assign sys_id of the record.
How to create record in profile table using scripts?
Thanks.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2018 01:36 AM
There's a field name Table in sn_grc_profile table and i set the field to the current table name and set applies_to to the record's sysid.
Above steps helped me to set the document id.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2018 04:59 PM
Hi,
To be able to use a document_id field you also need to have a table field on the table so it know which table the sys_id belongs to.
Here is a good example how to setup that: Document ID field | ServiceNow Docs
and here is a good example how to write the script: How to set a value to a document ID field using script - Developer Community - ServiceNow Community
//Göran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2018 09:24 PM
Thanks for the response, Goran.
Documentid field could be dynamically constructed ie. table name + sysid and saved in a string field?
Since table has already been created, now I don't have liberty to modify the table design(technically yes, but not in business perspective).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2018 01:36 AM
There's a field name Table in sn_grc_profile table and i set the field to the current table name and set applies_to to the record's sysid.
Above steps helped me to set the document id.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2023 06:57 AM
Hello Balaji,
I have one issue while set RITM reference to the field "Approving"("document_id") in "sysapproval_approver" table .
i have done below script , but it is not working.
var gr = new GlideRecord("sysapproval_approver");
gr.document_id = RITM_sys_id;
gr.update();
could you please help me on that
Thanks in Advance,
Raghav