The PA script written to fetch the top 10 Assignment groups based on incident count is not working

Nasreen2
Tera Expert

The PA script written to fetch the Top 10 Assignment groups based on the incident assignment count is working fine in Background scripts but when I tried it in the Breakdown mapping of Breakdown or in the Indicator , I am unable to fetch that result in the dashboard through the PA widget(Widget type which I used was Breakdown - Scorecard). If I get this data displayed in the Widget type of Breakdown - Pivot Scorecard will be much more helpful!!!

 

The script that was written is as follows:

Facts table: incident

Fields: Assignment group

 

Script:

var assignGroups = function getGroups() {
var groups = [];
var ga = new GlideAggregate('incident');
ga.addActiveQuery();
ga.addAggregate('COUNT', 'assignment_group');
ga.orderByAggregate('count', 'assignment_group');
ga.setLimit(10);
ga.query();
while (ga.next()) {
groups.push(ga.assignment_group.getDisplayValue());
//gs.info('Top 10 Assignment Group: ' + ga.assignment_group.getDisplayValue() + ' ' + ga.getAggregate('COUNT', 'assignment_group'));

}
gs.info('Top 10' + groups);
return groups;
};

assignGroups();

 

Could anyone let me know if there is anything else which needs to be done or am I missing something here?

 

Thanks!

1 REPLY 1

Bhuvaneswari T
Tera Contributor

Hi, Did you find any solution for this ? I am trying something similar but no luck so far