Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2025 12:52 AM
you will have to use script in script include and call it OR directly have script in advanced ref qualifier
something like this
Note: give correct choice value for A, B and the correct sysIds
javascript: var query='';
if(current.variables.firstVariable == 'choice value A')
query = 'sys_idINsysId1,sysId2'; // populate the 2 records which should be seen
else if(current.variables.firstVariable == 'choice value B')
query = 'sys_idINsysId3,sysId4'; // populate the 2 records which should be seen
query;
If you want to auto populate the reference variable based on option A or B selected then you can write onChange catalog client script on that drop down variable
something like this
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (newValue == 'choice A')
g_form.setValue('variable2nd', 'sysId1');
else if (newValue == 'choice B')
g_form.setValue('variable2nd', 'sysId2');
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards,
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader