Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Show only Configuration Item whose class is marked as Principal CI

sntech
Tera Contributor

Hi Team,

 

The requirement is to show only Configuration Item on task table whose class is marked as Principal CI.

 

I used advanced reference qualifier and its script as below.

 

(function() {
var classList = [];
var gr = new GlideRecord('cmdb_class_info');
gr.addQuery('principal_class', true);
gr.query();
while (gr.next()) {
classList.push(gr.name.toString());
}
return 'sys_class_nameIN' + classList.join(',');
})();

 

 

 

This script worked in PDI, but not working in actual environment.

 

Is there any other possible way?

 

 

 

Thanks

2 REPLIES 2

Swapna Abburi
Mega Sage
Mega Sage

Hi @sntech 

we already have an OOTB script include and function to filter CIs by principal CI classes. You can use it instead of writing a custom script.

 

javascript:new TaskUtils().getConfigurationItemFilter(current);

Ankur Bawiskar
Tera Patron
Tera Patron

@sntech 

share dictionary screenshot of the field where you applied this

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader