Skip to content

Commit 4a9be5b

Browse files
README.md
1 parent a260097 commit 4a9be5b

File tree

1 file changed

+38
-0
lines changed
  • Server-Side Components/Server Side/Count Inactive Users with Active incidents

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Count Active Incidents Assigned to Inactive Users
2+
3+
This script uses GlideAggregate to efficiently count the number of active incidents assigned to inactive users.
4+
5+
This is a crucial task for maintaining data hygiene and preventing incidents from being stalled due to inactive assignees.
6+
7+
Overview The script performs the following actions: Initializes GlideAggregate: Creates an aggregate query on the incident table.
8+
9+
Filters Records: Uses addQuery() to restrict the search to incidents that are both active (true) and assigned to a user whose active status is false.
10+
11+
This filter uses a "dot-walk" on the assigned_to field to check the user's active status directly within the query.
12+
13+
Aggregates by Count: Uses addAggregate() to count the number of incidents, grouping the results by assigned_to user.
14+
15+
Executes and Logs: Runs the query, then loops through the results.
16+
17+
For each inactive user found, it logs their name and the number of active incidents assigned to them. Use case This script is essential for regular cleanup and maintenance.
18+
19+
It can be used in: Scheduled Job: Automatically run the script daily or weekly to monitor for and report on incidents assigned to inactive users.
20+
21+
Installation As a Scheduled Job Navigate to System Definition > Scheduled Jobs.
22+
23+
24+
Click New and select Automatically run a script of your choosing. Name the job (e.g., Find Incidents Assigned to Inactive Users).
25+
26+
27+
Set your desired frequency and time. Paste the script into the Run this script field. Save and activate the job. As a Fix Script Navigate to System Definition > Fix Scripts.
28+
29+
Click New. Name it (e.g., Find Active Incidents with Inactive Assignee).
30+
31+
32+
Paste the script into the Script field. Run the script to see the results in the System Log.
33+
34+
35+
Customization Targeted tables: Change the table name from incident to task or any other table with an assigned_to field to check for active records assigned to inactive users.
36+
37+
38+
Automated reassignment: Extend the script to automatically reassign the incidents to a group or another user. This is a common practice to ensure that tickets do not get stuck in the queue. Email notification: Instead of logging the information, modify the script to send an email notification to the group manager or another stakeholder with the list of incidents needing attention.

0 commit comments

Comments
 (0)