How to get class wise CI count which are active?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2022 03:20 AM
How to get class wise CI count which are active?
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2022 03:29 AM
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