How to create a breakdown by New Values on the Incident Metric table in Performance Analytics

tsoct
Tera Guru

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.

find_real_file.png

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);

1 ACCEPTED SOLUTION

Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

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


View solution in original post

6 REPLIES 6

Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

You can just use your normal Assignment group Breakdown, and create the breakdown mapping to mi_field_value No scripting should be necessary


Did you try this?


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.


find_real_file.png



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?


find_real_file.png



The details of the xxxx_assignment group breakdown


find_real_file.png


I can see it mapped correctly to the indicator.


find_real_file.png


Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

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