- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2026 07:00 PM
Hello All,I have the following setup, but Variable 2 isn’t working as intended. I’d like advice on how to fix or improve it.
Configuration:
Variable 1 (directly under the Catalog Item)
- Name: va_category
- Type: Reference
- Type specifications:
- Reference: sys_choice
- Use reference qualifier: Advanced
- Reference qualifier:javascript:"element=category^name=incident^inactive=false^language="+gs.getUser().getLanguage();
Variable set: vs_subcategory_details
Variable 2 (inside the variable set)
- Name: va_subcategory
- Type: Reference
- Type specifications:
- Reference: sys_choice
- Use reference qualifier: Advanced
- Reference qualifier (not working):javascript:"name=incident^element=subcategory^inactive=false^dependent_value="+current.variables.va_category.value+"^language="+gs.getUser().getLanguage()
I want Variable 2 to show only the subcategories for the category selected in Variable 1.
This works if both variables are directly under the catalog item, but it fails when Variable 2 is inside a variable set.
If this is achievable, could you please advise on the correct approach or best practice?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2026 10:00 PM
correct, that's the reason.
we are storing sysId but the ref qualifier requires the value of that choice
you can do this in your onLoad catalog client script
function onLoad() {
var cat = g_service_catalog.parent.getValue("va_category");
// use GlideAjax here and pass the sysId and query sys_choice with that sysId and return value and then set in hidden field
g_form.setValue('hiddenVariableName', cat);
g_form.setDisplay('hiddenVariableName', false);
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2026 09:42 PM
@Ankur Bawiskar ,I was able to confirm that the sysid of variable 1 is displayed in hiddenVariableName.
However, variable 2 did not work.
I suspect variable 2 may not function properly unless the value of sys_choice is passed to it. What do you think?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2026 10:00 PM
correct, that's the reason.
we are storing sysId but the ref qualifier requires the value of that choice
you can do this in your onLoad catalog client script
function onLoad() {
var cat = g_service_catalog.parent.getValue("va_category");
// use GlideAjax here and pass the sysId and query sys_choice with that sysId and return value and then set in hidden field
g_form.setValue('hiddenVariableName', cat);
g_form.setDisplay('hiddenVariableName', false);
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2026 10:50 PM
@Ankur Bawiskar ,How should I specifically write the script for the following?
// use GlideAjax here and pass the sysId and query sys_choice with that sysId and return value and then set in hidden field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2026 10:53 PM
I hope you are aware how GlideAjax script is written.
if not then check this and enhance
GlideAjax Example Cheat Sheet (UPDATED)
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2026 12:45 AM
Thanks to your help, I was able to resolve the issue.
Using the following client script, I achieved the desired behavior.
(I’m omitting the Script Include here.)

