Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Filter Configuration Item Template based on Principle Classes

williame
Tera Contributor

Request was to only allow templates to see principle classes ( same as the CI field on the Change ticket was filtered).

This reduced CI numbers from 2m to 90k 

 

Solution:

I combined 2 community posts into 1 Business Rule on the cmdb_ci table

 

(function executeRule(current, previous /*null when async*/ ) {

try {
if (gs.action.getGlideURI().getMap().get('sysparm_target')) {
var targetName = gs.action.getGlideURI().getMap().get('sysparm_target');
if (targetName.indexOf('change_request.cmdb_ci') > -1) {
current.addEncodedQuery('sys_class_nameINjavascript:new PrincipalClass().getPrincipalClasses()');
}
}
} catch (e) {}

})(current, previous);

 

Referenced

https://www.servicenow.com/community/now-platform-forum/filtering-on-principal-class/m-p/1072188

and 

https://www.servicenow.com/community/developer-forum/applying-reference-qualifiers-on-standard-chang...

0 REPLIES 0