- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2017 01:39 AM
Hello all,
I am trying to create a widget on PA, which measures the number of incident tickets inflow to a certain assignment group. As a ticket might get reassigned to different assignment groups few times before resolved, I will need to get the number of tickets inflow from Incident metric table using "new value" field.
I did follow the steps in How can I create a breakdown by task type on the Time Card table? but need help with the script.
How should I modify the script below to capture Definition = Assignment Group and value that captured in manual breakdown must not duplicate?
Ex: ServiceNow Admin appears two times. The script below should capture only one "ServiceNow Admin" to the manual breakdown table.
var table = 'task';
var col = 'sys_class_name';
var breakdown = '[sys_id of manual breakdown]';
gs.log('Collection of Task types started');
//do not modify:
(function(table, col, breakdown) {
var ga = new GlideAggregate(table);
ga.addAggregate('COUNT', col);
ga.query();
while(ga.next()) {
var value = ga.getDisplayValue(col);
var gr = new GlideRecord('pa_manual_breakdowns');
gr.addQuery('breakdown', breakdown);
gr.addQuery('value', value);
gr.query();
if(!gr.next()) {
gr = new GlideRecord('pa_manual_breakdowns');
gr.initialize();
gr.setValue('breakdown', breakdown);
gr.setValue('value', value);
gr.insert();
gr.close();
}
}
ga.close();
gs.log('Collection of Task types finished');
}) (table, col, breakdown);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2017 07:58 AM
Your mapping is to mi_value, change this to mi_field_value (this contains the group sys_id)
Also, try not using duplicate breakdowns I would recommend
Original correct answer:
You can just use your normal Assignment group Breakdown, and create the breakdown mapping to mi_field_value No scripting should be necessary
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2017 05:02 AM
You can just use your normal Assignment group Breakdown, and create the breakdown mapping to mi_field_value No scripting should be necessary
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2017 05:56 AM
Did you try this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2017 05:00 AM
Hi Arnoud,
Sorry for the late reply. Thanks for your reply above. I tried but from the breakdown of the indicator, it shows two assignment group breakdown.
1. Assignment group - which I believed is something out of the box. The number shows correctly as 1.
2. xxxx_AssignmentGroup - This is created by me with the steps that you advised above. It displayed few groups only as per my filter, however, the numbers are 0.
Do you have any idea why?
The details of the xxxx_assignment group breakdown
I can see it mapped correctly to the indicator.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2017 07:58 AM
Your mapping is to mi_value, change this to mi_field_value (this contains the group sys_id)
Also, try not using duplicate breakdowns I would recommend
Original correct answer:
You can just use your normal Assignment group Breakdown, and create the breakdown mapping to mi_field_value No scripting should be necessary