Blog

Configuration Items without Business Service

Here is a report you can build to find Configuration Items without Business Services associated.

Script Include

Name: getCIWithoutBusinessService
Table: Global [global]
Client Callable: true
Script:
// Return an array of sys_ids of CIs without Business service
function getCIWithoutBusinessService(table) {
var configItems = [];
var grCI = new GlideRecord(table);
grCI.addActiveQuery();
grCI.addQuery('grCI.sys_class_name','=',table);
grCI.addQuery('grCI.sys_class_name','!=','cmdb_ci_service');
grCI.query();
while (grCI.next()) {
var configItem = grCI.name.toString();
var grCIRel = new GlideRecord('cmdb_rel_ci');
grCIRel.addActiveQuery();
grCIRel.addQuery('parent.sys_class_name','=','cmdb_ci_service');
grCIRel.addQuery('child','=',grCI.sys_id);
grCIRel.addQuery('child.sys_class_name','!=','cmdb_ci_service');
grCIRel.query();
if (grCIRel.getRowCount() > 1) {
configItems.push(configItem);
}
}
//gs.print(configItems);
return configItems;
}

Report Example 1

Report Title: Configuration Item without Business Service
Table: Configuration Item
Type: List
Filter: Name is one of javascript: getCIWithoutBusinessService('cmdb_ci')

Report Example 2

Report Title: Application without Business Service
Table: Application
Type: List
Filter: Name is one of javascript: getCIWithoutBusinessService('cmdb_ci_appl')