- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 09:44 AM
I'm configuring a record producer which has 2 variables.
- cmdb_ci - This is a reference field for the Primary Configuration item restricted to certain CI Classes and statuses on the cmdb_ci table.
- additional_cis - This is a list field for the Secondary Configuration Items restricted to certain CI Classes and statuses on the cmdb_ci table. This is hidden via Catalog UI Policy until an option is chosen for the cmdb_ci variable.
I want to avoid the option chosen in the cmdb_ci variable to be available for selection on the 2nd additional_cis variable. I've tried using '^sys_id!=current.variables.cmdb_ci' in the advanced reference qualifier to avoid it showing (and in different variations) but the option chosen in the first variable still shows in the 2nd.
sys_class_name=cmdb_ci_vm^ORsys_class_name=u_cmdb_ci_pf_server^ORsys_class_name=cmdb_ci_server^ORsys_class_name=u_cmdb_ci_nw_firewall^ORsys_class_name=u_load_balancer^ORsys_class_name=cmdb_ci_lb^ORsys_class_name=u_router_switch^ORsys_class_name=cmdb_ci_switch^ORsys_class_name=u_cmdb_ci_nw_switch^ORsys_class_name=u_cmdb_ci_ap_mssql^ORsys_class_name=cmdb_ci_esx_server^ORsys_class_name=u_cmdb_ci_cr_ipaccessport^ORsys_class_name=u_cmdb_ci_cr_leasedline^ORsys_class_name=u_cmdb_ci_cr_xconnect^install_statusIN16,9,2,3,8,12^sys_id!=current.variables.cmdb_ci
Any ideas on what I'm doing wrong? Many thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 12:13 PM - edited 08-04-2025 12:21 PM
OK, fixed..... just in case someone else is ever looking for a solution... including myself because my memory is terrible. 😂
Step 1: Create a new Script Include, in this case 'advancedRefQualifierCIPortal'. Make sure it's client callable and it's accessible from all application scopes.
var advancedRefQualifierCIPortal = Class.create();
advancedRefQualifierCIPortal.prototype = {
initialize: function() {
},
hideCmdbciVariable:function(primaryConfig){
var cmdbci = primaryConfig.toString();
var classAndStatus = 'sys_class_name=cmdb_ci_vm^ORsys_class_name=u_cmdb_ci_pf_server^ORsys_class_name=cmdb_ci_server^ORsys_class_name=u_cmdb_ci_nw_firewall^ORsys_class_name=u_load_balancer^ORsys_class_name=cmdb_ci_lb^ORsys_class_name=u_router_switch^ORsys_class_name=cmdb_ci_switch^ORsys_class_name=u_cmdb_ci_nw_switch^ORsys_class_name=u_cmdb_ci_ap_mssql^ORsys_class_name=cmdb_ci_esx_server^ORsys_class_name=u_cmdb_ci_cr_ipaccessport^ORsys_class_name=u_cmdb_ci_cr_leasedline^ORsys_class_name=u_cmdb_ci_cr_xconnect^install_statusIN16,9,2,3,8,12';
return classAndStatus + "^sys_id!=" + cmdbci;
},
type: 'advancedRefQualifierCIPortal'
};
Step 2: Update the advanced reference qualifier to call that Script Include, but make sure you pass in the 'current.variables.cmdb_ci' data when calling the function.
javascript:new advancedRefQualifierCIPortal().hideCmdbciVariable(current.variables.cmdb_ci)
And voila, the reference qualifier will call the script include and will apply the original/working CI Classes and statuses and then append the sys_id of the offending CI from the cmdb_ci variable, meaning it won't show.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2025 12:13 PM - edited 08-04-2025 12:21 PM
OK, fixed..... just in case someone else is ever looking for a solution... including myself because my memory is terrible. 😂
Step 1: Create a new Script Include, in this case 'advancedRefQualifierCIPortal'. Make sure it's client callable and it's accessible from all application scopes.
var advancedRefQualifierCIPortal = Class.create();
advancedRefQualifierCIPortal.prototype = {
initialize: function() {
},
hideCmdbciVariable:function(primaryConfig){
var cmdbci = primaryConfig.toString();
var classAndStatus = 'sys_class_name=cmdb_ci_vm^ORsys_class_name=u_cmdb_ci_pf_server^ORsys_class_name=cmdb_ci_server^ORsys_class_name=u_cmdb_ci_nw_firewall^ORsys_class_name=u_load_balancer^ORsys_class_name=cmdb_ci_lb^ORsys_class_name=u_router_switch^ORsys_class_name=cmdb_ci_switch^ORsys_class_name=u_cmdb_ci_nw_switch^ORsys_class_name=u_cmdb_ci_ap_mssql^ORsys_class_name=cmdb_ci_esx_server^ORsys_class_name=u_cmdb_ci_cr_ipaccessport^ORsys_class_name=u_cmdb_ci_cr_leasedline^ORsys_class_name=u_cmdb_ci_cr_xconnect^install_statusIN16,9,2,3,8,12';
return classAndStatus + "^sys_id!=" + cmdbci;
},
type: 'advancedRefQualifierCIPortal'
};
Step 2: Update the advanced reference qualifier to call that Script Include, but make sure you pass in the 'current.variables.cmdb_ci' data when calling the function.
javascript:new advancedRefQualifierCIPortal().hideCmdbciVariable(current.variables.cmdb_ci)
And voila, the reference qualifier will call the script include and will apply the original/working CI Classes and statuses and then append the sys_id of the offending CI from the cmdb_ci variable, meaning it won't show.