Some PDIs are currently unavailable, and PDI actions are paused. View the latest updates here. Read More

How to get class wise CI count which are active?

Not applicable

How to get class wise CI count which are active?

1 REPLY 1

Muhammad Khan
Mega Sage

Hi,

Use below code in background script.

var count = new GlideAggregate('cmdb_ci');
count.addAggregate('COUNT', 'sys_mod_count');
count.groupBy('sys_class_name');
count.query();   

while (count.next()) {  
  var counts = count.getAggregate('COUNT', 'sys_mod_count');
  var className = count.sys_class_name.getDisplayValue();
  gs.print(className + ' Count= ' + counts);
}

 

Output

find_real_file.png