- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 12:59 PM
I am trying to create a catalog item. For the first variable, I need the user to select from a list of specific CMDB classes. I think the Lookup Multiple Choice variable type is the best option and I have the following settings:
- Lookup from table: sys_db_table
- Lookup value field: Label
- Unique values only: true
- Reference qualifier: javascript:new PhoneSystemClassQualifier().getPhoneSystemClasses();
The associated script include looks like:
var PhoneSystemClassQualifier = Class.create();
PhoneSystemClassQualifier.prototype = {
initialize: function() {},
getPhoneSystemClasses: function() {
var classes = [
'u_cmdb_ci_five9_phone_system',
'u_cmdb_ci_kandy_business_solution_phone_system',
'u_cmdb_ci_microsoft_teams_phone_system',
'u_cmdb_ci_synoptek_efax'
];
var gr = new GlideRecord('sys_db_object');
gr.addQuery('name', classes);
gr.query();
var sysIds = [];
while (gr.next()) {
sysIds.push(gr.get('sys_id'));
}
if (sysIds.length === 0) {
return 'sys_idISEMPTY';
} else {
return 'sys_idIN' + sysIds.join(',');
}
},
type: 'PhoneSystemClassQualifier'
};
When I go "Try It", SN is showing all classes in the CMDB. What am I missing?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 09:32 PM
Why not have a select box i.e. drop down with 4 choices?
if not then why not apply simple filter condition on that variable itself rather than script include and ref qualifier?
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
01-05-2025 05:26 AM
Hope you are doing good.
Did my reply answer your question?
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
01-06-2025 11:56 AM
Nothing else is working so I guess this is going to have to be it.