Skip to content

Commit d84dcae

Browse files
authored
Identify Inactive users with Open tickets (ServiceNowDevProgram#2602)
* Create identify_inactive_users_with_open_tickets.js * Create README.md
1 parent 1eb0d43 commit d84dcae

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# ServiceNow Background Script – Identify Inactive Users with Open Incidents
2+
3+
This background script helps admin to identify **inactive users** who still have **open incidents** assigned to them.
4+
It’s particularly useful during **user cleanup, offboarding audits, or reassignment activities** to ensure no tickets remain unaddressed.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var user = new GlideRecord('sys_user');
2+
user.addQuery('active', false);
3+
user.query();
4+
while (user.next()) {
5+
var inc = new GlideRecord('incident');
6+
inc.addQuery('assigned_to', user.sys_id);
7+
inc.addQuery('state', '!=', 7); // not Closed
8+
inc.query();
9+
while (inc.next()) {
10+
gs.info('Inactive user with open ticket: ' + user.name + ' → ' + inc.number);
11+
}
12+
}

0 commit comments

Comments
 (0)