- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2022 10:56 AM
On change of "Assigned to" field, display information about active assigned incidents count of corresponding agent selected under the "Assigned to" field.
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2022 10:41 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2022 11:18 AM
Need more information. Is the requirement to keep info there and up to date? Or is it just a temporary display that only shows when a incident is assigned?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2022 08:28 AM
yeah brian requirement to keep info there and up to date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2022 08:41 AM
Whenever "Assigned to' field populated with a new agent, active assigned incidents count should be displayed as a info message under the 'Assigned to' field.
Message should be cleared, if "Assigned to" field is empty.
No message should appear after updating the incident record.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2022 11:21 AM
Hi,
Here is a example I tested on my PDI.
When the assigned to value changes on the incident, the new selected user's assigned to incidents are counted up and will be alerted on the screen.
You can change the alert to whatever you need to do with the value.
Script include Name: getAssignedToCount
var getAssignedToCount = Class.create();
getAssignedToCount.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getAssignedTo: function(){
var assignedTo = this.getParameter('sysparm_assignedto');
var incidentGA = new GlideAggregate('incident');
incidentGA.addQuery('assigned_to', assignedTo);
incidentGA.addAggregate('COUNT');
incidentGA.query();
if(incidentGA.next()){
incidentGA.next();
var json = new JSON();
var count = incidentGA.getAggregate('COUNT');
return JSON.stringify(count);
}else{
return null;
}
},
type: 'getAssignedToCount'
});
Client Script (onChange -> Assigned to field)
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var rec = new GlideAjax('getAssignedToCount');
rec.addParam('sysparm_name', 'getAssignedTo');
rec.addParam('sysparm_assignedto', newValue);
rec.getXML(populateData);
// When the response is back from the server
function populateData(response) {
var answer = response.responseXML.documentElement.getAttribute('answer');
var result = JSON.parse(answer);
alert('Total assigned incident count for this user: ' + result);
}
}
Hope this helps.
Please mark my answer as Correct/Helpful based on impact
Regards,
Dan H