Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
@@ -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);
}
}
Loading