How to get "sys_id" from a Document Id field and set that "sys_id" into a reference field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2020 12:25 PM
How to get "sys_id" from a Document Id field and set that "sys_id" into a reference field.
I have written the below script,
var display = current.trigger_id.getDisplayValue();
var number = display.split(' ')[1];
current.u_interaction.setDisplayValue(number);
current.update();
It was returning the "number" from the "trigger_id" field properly and getting that number displayed in the "u_interaction" reference field.
Instead of the "Number" getting populated in "u_interaction" field, sys_id should get populated in that field, how to get sys_is populated instead of number.
Thanks & Regards,
S.Swaroop.
- 4,660 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2020 12:28 PM
Hi Swaroop,
Try using,
current.trigger_id.sys_id;
instead of
current.trigger_id.getDisplayValue();
There are couple of options that document field support with .sys_id being one of those. This will give you sys_id of the record directly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2020 12:43 PM
Hello Jaspal,
Thanks for the quick reply,
When i am using the below script, number is getting populated in the "u_interaction" field, but i want sys_is to be populated, which is not getting populated. Below is the script i am using.
var number = current.trigger_id.sys_id;
current.u_interaction.setDisplayValue(number);
current.update();
Can you please rectify me if i am doing mistake anywhere in the above script.
Thanks & Regards,
S.Swaroop.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2020 12:47 PM
Try using below.
var number = current.trigger_id.sys_id;
gs.log('Sysid is ',number);
current.u_interaction=number;
current.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2020 12:54 PM
Hello Jaspal,
Still it was returning the "number" of the ticket, not populating with "sys_id".
Thanks & Regards,
S.Swaroop.