Filter Lookup selectbox variable choices based on variables in variable set.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2025 11:48 PM
Hi Community,
I want to put reference qualifier filter on lookup selectbox variable based on the variable in variable set.
I have 15 checkbox variables and based on these i need to filter the lookup selectbox, need the reference qualifier condition or any another best approach.
Thanks & Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2025 12:10 AM
you can always access the checkbox variable in advanced ref qualifier of Lookup select box variable and then form the query
Syntax -> current.variables.checkboxVariableName1
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-16-2025 03:47 AM
Thank you for marking my response as helpful.
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-15-2025 12:11 AM
Hello @Deepak Shaerma ,
Write onChange client script to achieve the functionality.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2025 12:22 AM - edited 07-15-2025 02:19 AM
Hello @Deepak Shaerma !
current.variables.<varName> is available in an advanced qualifier and returns the live value of each variable. Below is an example of an advanced reference qualifier that you can adjust to your needs in an editor and paste in the reference qualifier field of the lookup select box:
javascript :
(function () {
// list the check-box variable names once
var boxes = [
'system_a','system_b','system_c',/* … */'system_o'
];
var selected = [];
boxes.forEach(function (v) {
if (current.variables[v] == 'true') // checkbox checked
selected.push(v);
});
// Build the filter (u_subsystem is just an example field)
var q = 'active=true';
if (selected.length) {
q += '^u_subsystemIN' + selected.join(',');
}
return q; // MUST return a string
})();
Please consider marking my answer as helpful and accepting it as the solution if it assisted you in any way.