Variable choice values options are visible separately in another vaible
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2025 02:11 AM
Hello everyone,
I have two variable, App type (Check box), app name (reference)
App type having the choices Regular , contract
App name having option coming from reference table those are -Req-emp, Reg-cntrl, Reg-impact, Reg-az600,Contract-emp,Contract-cntrl, Contract-impact, contract-az600
If i select Regular value in App type in app Name only visible --Req-emp, Reg-cntrl, Reg-impact, Reg-az600 these option
If i select Contract value in App type in app Name only visible --Contract-emp,Contract-cntrl, Contract-impact, contract-az600 these option.
Please provide solution to this one
Regards,
manohararuna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2025 02:25 AM - edited 07-10-2025 02:35 AM
Hi @Manohararuna ,
You may need to create script include to return the query back to app name variable
call script include in Reference Qualifier of app name variable. Pass contract and regular checkbox variables into function
javascript: new ScriptInclude().getchoiceQuery(current.variables.u_regular,current.variables.u_contract);
And In script include you can perform the operation and return query
Sample script include function:
If it works for you, mark it as correct and helpful
Thanks, GP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2025 02:28 AM
You may use on Change + Reference Qualifier (advanced)
onChange
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
// Clear previous selection in 'app_name'
g_form.setValue('app_name', '');
// Ensure the field is visible and editable
g_form.setDisplay('app_name', true);
g_form.setReadOnly('app_name', false);
// Refresh the reference field to apply the new filter
g_form.refreshReferenceField('app_name');
}
Reference Qualifier
var appType = g_form.getValue('app_type');
if (appType == 'Regular') {
// Show only application names starting with 'Req-emp' or 'Reg-'
answer = "nameSTARTSWITHReq-emp^ORnameSTARTSWITHReg-";
} else if (appType == 'Contract') {
// Show only application names starting with 'Contract-'
answer = "nameSTARTSWITHContract-";
} else {
// If no app type is selected, show all records
answer = "";
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2025 03:03 AM
Share catalog item screenshots.
You said you have 2 variables but you are saying 1st is checkbox then checkbox can be either true/false
where are the choices Regular or Contract coming from?
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
07-10-2025 03:19 AM