Skip to content
Closed
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,32 @@
(function() {
var MAX_REASSIGNMENTS = 5;
var flaggedIncidents = [];
var flaggedCount = 0;
var totalChecked = 0;
var incGR = new GlideRecord('incident');
incGR.addActiveQuery();
incGR.query();
while (incGR.next()) {
totalChecked++;
// Count how many times 'assigned_to' changed
var auditAgg = new GlideAggregate('sys_audit');
auditAgg.addQuery('documentkey', incGR.getUniqueValue());
auditAgg.addQuery('fieldname', 'assigned_to');
auditAgg.addAggregate('COUNT');
auditAgg.query();
var reassignmentCount = 0;
if (auditAgg.next()) {
reassignmentCount = parseInt(auditAgg.getAggregate('COUNT'), 10);
}
// Flag incidents exceeding threshold
if (reassignmentCount > MAX_REASSIGNMENTS) {
flaggedIncidents.push(incGR.getValue('number'));
flaggedCount++;
}
}
gs.info(' Checked: ' + totalChecked + ' | Flagged: ' + flaggedCount + ' | Threshold: ' + MAX_REASSIGNMENTS);
if (flaggedIncidents.length > 0)
gs.info(' Flagged Incidents: ' + flaggedIncidents.join(', '));
else
gs.info(' No incidents exceeded the reassignment threshold.');
})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Incident Reassignment Tracker
Use Case -
In IT service management, incidents are sometimes reassigned multiple times before reaching the right technician.
This script helps identify incidents that have been **reassigned more than 5 times**, so managers can review the assignment process and reduce ticket bouncing.

How It Works -
1. Loops through all **active incidents**.
2. Counts how many times the **`assigned_to`** field changed using the `sys_audit` table.
3. Prints the incident numbers in the system logs if they exceed the threshold (5 reassignments by default).
Loading