Want to show Application class CI when category is Application
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2025 09:54 AM
Hello All,
I've a requirement to show only Application class CI's in configuration item field whenever category is Application on the change form. Can we use Script include and client script or script include and advance ref qual. Can anyone suggest script include and client script or advance ref qual. The field has already a ref qual. So, client script will be the solution.
Thanks in Advance!
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2025 11:20 AM
You can use the script include and onChange catalog client script below:
Script include:
var GetCIReferenceFilter = Class.create();
GetCIReferenceFilter.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getCIQualifier: function() {
var category = this.getParameter('sysparm_category');
var qual = '';
if (category == 'Application') {
// Filter for Application class CIs
qual = 'sys_class_name=cmdb_ci_appl^install_status!=7';
} else {
// Optional: return a default or open query
qual = '';
}
return qual;
}
});
onChange Client script on the "category" field of the "change_request"
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') return;
var ga = new GlideAjax('GetCIReferenceFilter');
ga.addParam('sysparm_name', 'getCIQualifier');
ga.addParam('sysparm_category', newValue);
ga.getXMLAnswer(function(response) {
var ciFilter = response;
g_form.setReferenceQual('cmdb_ci', ciFilter);
});
}