From 82fe3b38c1087900f59cff328d1281e4445d71bd Mon Sep 17 00:00:00 2001 From: anjimuvva <42597425+anjimuvva@users.noreply.github.com> Date: Wed, 29 Oct 2025 12:45:17 +0800 Subject: [PATCH 1/4] Create identify_inactive_users_with_open_tickets.js --- .../identify_inactive_users_with_open_tickets.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Server-Side Components/Background Scripts/Identify Inactive users with tickets/identify_inactive_users_with_open_tickets.js diff --git a/Server-Side Components/Background Scripts/Identify Inactive users with tickets/identify_inactive_users_with_open_tickets.js b/Server-Side Components/Background Scripts/Identify Inactive users with tickets/identify_inactive_users_with_open_tickets.js new file mode 100644 index 0000000000..aa83326a2e --- /dev/null +++ b/Server-Side Components/Background Scripts/Identify Inactive users with tickets/identify_inactive_users_with_open_tickets.js @@ -0,0 +1,12 @@ +var user = new GlideRecord('sys_user'); +user.addQuery('active', false); +user.query(); +while (user.next()) { + var inc = new GlideRecord('incident'); + inc.addQuery('assigned_to', user.sys_id); + inc.addQuery('state', '!=', 7); // not Closed + inc.query(); + while (inc.next()) { + gs.info('Inactive user with open ticket: ' + user.name + ' → ' + inc.number); + } +} From 101697bf902df131d0903b1994dff554498e3461 Mon Sep 17 00:00:00 2001 From: anjimuvva <42597425+anjimuvva@users.noreply.github.com> Date: Wed, 29 Oct 2025 12:45:58 +0800 Subject: [PATCH 2/4] Create README.md --- .../Identify Inactive users with tickets/README.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Server-Side Components/Background Scripts/Identify Inactive users with tickets/README.md diff --git a/Server-Side Components/Background Scripts/Identify Inactive users with tickets/README.md b/Server-Side Components/Background Scripts/Identify Inactive users with tickets/README.md new file mode 100644 index 0000000000..ddff5edf85 --- /dev/null +++ b/Server-Side Components/Background Scripts/Identify Inactive users with tickets/README.md @@ -0,0 +1,4 @@ +# ServiceNow Background Script – Identify Inactive Users with Open Incidents + +This background script helps admin to identify **inactive users** who still have **open incidents** assigned to them. +It’s particularly useful during **user cleanup, offboarding audits, or reassignment activities** to ensure no tickets remain unaddressed. From bfebf46429d853207d8fc8691a663d11a2e9be9e Mon Sep 17 00:00:00 2001 From: anjimuvva <42597425+anjimuvva@users.noreply.github.com> Date: Wed, 29 Oct 2025 23:27:02 +0800 Subject: [PATCH 3/4] Create README.md --- .../Background Scripts/Get Orphaned Incidents/README.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Server-Side Components/Background Scripts/Get Orphaned Incidents/README.md diff --git a/Server-Side Components/Background Scripts/Get Orphaned Incidents/README.md b/Server-Side Components/Background Scripts/Get Orphaned Incidents/README.md new file mode 100644 index 0000000000..2ae6fdca8f --- /dev/null +++ b/Server-Side Components/Background Scripts/Get Orphaned Incidents/README.md @@ -0,0 +1,5 @@ +# ServiceNow Background Script – Find Orphaned Incidents + +## 🧩 Overview +This background script identifies **orphaned incident records** — incidents that are not assigned to any **user** or **assignment group** and are still open. +It’s useful for **data quality audits**, **queue management**, and **incident triage improvement**. From dd5852026eb60b71dcb1cc8d063b0cfe91146ac1 Mon Sep 17 00:00:00 2001 From: anjimuvva <42597425+anjimuvva@users.noreply.github.com> Date: Wed, 29 Oct 2025 23:28:34 +0800 Subject: [PATCH 4/4] Create get_orphaned_incidents.js --- .../Get Orphaned Incidents/get_orphaned_incidents.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Server-Side Components/Background Scripts/Get Orphaned Incidents/get_orphaned_incidents.js diff --git a/Server-Side Components/Background Scripts/Get Orphaned Incidents/get_orphaned_incidents.js b/Server-Side Components/Background Scripts/Get Orphaned Incidents/get_orphaned_incidents.js new file mode 100644 index 0000000000..d9b02ceb64 --- /dev/null +++ b/Server-Side Components/Background Scripts/Get Orphaned Incidents/get_orphaned_incidents.js @@ -0,0 +1,9 @@ +var gr = new GlideRecord('incident'); +gr.addNullQuery('assigned_to'); +gr.addNullQuery('assignment_group'); +gr.addQuery('state', '!=', 7); // not closed +gr.query(); +gs.info("Orphaned Incidents Count:"+gr.getRowCount()); +while (gr.next()) { + gs.info('Orphaned incident: ' + gr.number + ' - ' + gr.short_description); +}