How to specify what attribute value I want to return as a selection from a Reference Variable that's part of a variable set inside a catalog item?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 09:58 AM
I have a reference variable that is pulling a list of companies from a view. The view defines the Company name, Label, and SysId. I have configured the list layout to only show the company name and label when the user is making a selection, but when a selection is chosen, the value returned is the SysId and not the company name.
How can I make it so that when a selection is made, the company name is returned instead of the SysId?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 10:15 AM
Hey,
It is only going to return sys_id, reference field is essentially a reference to a record in a different table, so even in the list layout you have gone with multiple fields, you are going to end up with sys_id.
What is your use case, are you trying to fetch the name in a script, in that case you can use getReference, or getDisplayBox or GlideAjax to get access of the name in the script.
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 10:31 AM
Thanks for the reply,
If that is the case, can you show me a script that would be similar to auto-populating the name of the company into another variable based on the SysID returned for this selection. A link to a very simple example would be helpful and greatly appreciated

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2022 10:08 AM
Follow below link:
https://community.servicenow.com/community?id=community_article&sys_id=c918c3b8db968c5013b5fb2439961918
Aman Kumar