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,661 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2020 12:57 PM
u_interaction is a reference field or is a string field? If reference try setting the value to a string filed it should set sys_id.
Since, for reference it will check for sys_id but will reflect that is used as the Display Value for the record.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2020 01:22 PM
Hi Swaroop,
Here you go. You don't need to call getDisplayValue() on trigger_id.
document_id itself holds the sys_id of the record. Please try below in your business rule and see how it goes. I am using this on Assessment Instance table for driving logic's. Hope this will help.
var display = current.trigger_id;
gs.addInfoMessage("SYS ID - " + display);
current.u_interaction = display;
current.update();
Please mark this accepted & helpful if it answered your question.
Thanks,
Sharjeel
Muhammad