PAIN Value Calculation

karl_james
Kilo Explorer

Hi All

I've been pretty good with my scripting within SN but I'm having an issue that I'm hoping someone can help with. Our Problem Manager asked for a PAIN value field to be added to our problem form, which is all good.

I'd like to write a script to calculate the PAIN value and populate the field to save some time and increase accuracy of the values for reporting. Below is the calculation to get this value:

(V x Y) x Z = PVC

V = Severity of each related Incident

  • Severity 1 = 1000 points
  • Severity 2 = 800 points
  • Severity 3 = 500 points

Y = Number of related Incidents x V

Z = Total Outage Hours x Y

Has anyone done anything like this before?

1 ACCEPTED SOLUTION

Your X and Y values ...



var severityArray = [];
severityArray["1"]=1000;
severityArray["2"]=800;
severityArray["2"]=500;


var X = severityArray[current.severity];


var count = new GlideAggregate('incident');
count.addEncodedQuery('parent='+current.sys_id);
count.addAggregate('COUNT');
count.query();
var Y = 0;
if (count.next())
Y = count.getAggregate('COUNT');


View solution in original post

15 REPLIES 15

Kalaiarasan Pus
Giga Sage

What will you say as related incidents? incidents by same caller ? or child incidents?


What is outage hours ? integer value or float ?


Thanks for the quick response Kalai!



Sorry I mean child incidents, will update the question. Also outage hours would be an integer.



Thanks


outage hours is a field on incident form ?


I'm going to calculate the outage hours using the outage start and end fields that are currently on the Incident form