- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2018 11:51 AM
How do you get the sys_id of a reference field via server script?
I tried the following, but I am getting the displayed name instead of the sys_id.
'"table".getValue('name')'.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2018 01:10 PM
If Assignment Group is a reference field, I would just do current.assignment_group. I would name add name (current.assignment_group.name), which will give me the display value.
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2018 11:56 AM
Can you try getUniqueValue() instead?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2018 01:07 PM
It is still pulling the display name...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2018 10:57 AM
Thank you this worked!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2018 12:28 PM
Please check below sample code to get reference field sys id
In this code, department is reference field on sys_user table.
var user = new GlideRecord('sys_user');
user.get('62826bf03710200044e0bfc8bcbe5df1');
gs.print(user.department);
Regards,
Sachin