diff --git a/Core ServiceNow APIs/GlideAggregate/non_operational_ci_count/code.js b/Core ServiceNow APIs/GlideAggregate/non_operational_ci_count/code.js new file mode 100644 index 0000000000..2b1220ad50 --- /dev/null +++ b/Core ServiceNow APIs/GlideAggregate/non_operational_ci_count/code.js @@ -0,0 +1,10 @@ +var ga = new GlideAggregate('cmdb_ci_appl'); +ga.addQuery('operational_status', 2); // Non-operational +ga.addQuery('install_status', 1); // Installed +ga.addAggregate('COUNT'); +ga.query(); +var total = 0; +if (ga.next()) { + total = ga.getAggregate('COUNT'); +} +gs.info('Application CIs installed but not in operational count: ' + total); diff --git a/Core ServiceNow APIs/GlideAggregate/non_operational_ci_count/readme.md b/Core ServiceNow APIs/GlideAggregate/non_operational_ci_count/readme.md new file mode 100644 index 0000000000..a9e847c73f --- /dev/null +++ b/Core ServiceNow APIs/GlideAggregate/non_operational_ci_count/readme.md @@ -0,0 +1 @@ +Counts all application CIs where operational_status = 2 (non-operational) and install_status = 1 (installed). Outputs the total count to system logs for quick health and compliance checks.