- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2025 02:40 AM - edited ‎02-19-2025 02:41 AM
Hi everyone,
I am trying to dynamically add choices to a Select Box in a Service Catalog item based on the selected Entity. The logic is:
- If the Entity contains "abc", add two new MacBook choices.
- I can get the sys_id of the selected Entity using newValue, but when I try getDisplayValue(), it returns blank.
Issues & Questions:
- Why is getDisplayValue('entity') returning blank?
- Since I only have the sys_id, what’s the best way to get the display value inside a Catalog Client Script?
- Is there a better approach to dynamically add choices when "abc" is in the Entity name?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2025 03:02 AM
@gdo There is an issue with your code. Use the following.
var v = g_form.getDisplayValue("entity");
alert(v);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2025 02:54 AM
Is entity variable a reference variable?
If yes then the way how display value works is different in portal and native
here is my blog which talks about the same.
Get Display value of reference variable Service Catalog
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2025 02:59 AM
Hello,
Yes it is a reference, to the core_company table.
I saw your blog, but when I use :
var v = g_form_getDisplayValue("entity");
alert(v)
>> The alert on the portal returns blank.
I tried every method existing to get the display value. I only get the sys_id with newValue variable

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2025 03:02 AM
@gdo There is an issue with your code. Use the following.
var v = g_form.getDisplayValue("entity");
alert(v);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2025 02:59 AM
Hello @gdo
Please use g_form.DisplayBox('reference field name').value;
Please mark this as helpful / accepted solution if it resolves your issue.
Regards
Veer