From fe54e3fc949c5bbd36808ddc0aec80b6a10ee5e1 Mon Sep 17 00:00:00 2001 From: Rampriya <114834474+Rampriya-S@users.noreply.github.com> Date: Thu, 2 Oct 2025 16:54:40 -0400 Subject: [PATCH 1/2] Create readme.md 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. --- .../GlideAggregate/non_operational_ci_count/readme.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 Core ServiceNow APIs/GlideAggregate/non_operational_ci_count/readme.md 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. From d4c710e99e1495e0bef21ba971c6d966810174cd Mon Sep 17 00:00:00 2001 From: Rampriya <114834474+Rampriya-S@users.noreply.github.com> Date: Thu, 2 Oct 2025 16:55:46 -0400 Subject: [PATCH 2/2] Create code.js --- .../GlideAggregate/non_operational_ci_count/code.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Core ServiceNow APIs/GlideAggregate/non_operational_ci_count/code.js 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);