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

Awesome Arnoud!!!


You are a star!! works as expected now!



Thanks!


Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

Good, glad it works!