Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Utilizing bucket ranges to group Priority and new Severity field

Paul H2
Tera Contributor

Hello,

 

I am creating a report for major incident management, and we have recently (February) cut over from the out-of-the-box Priority field to a new Severity field. In order to look at both fields at once over a period of time, we created a script to group tickets based on their severity or priority, the body of which is below.

var res = 0;
if(incident_severity==0 || incident_severity==1 || incident_severity==2)
	{res = 1;}
if(incident_severity==3)
	{res = 21;}	
if(incident_severity==4)
	{res = 31;}
if (incident_severity == null)
	if(incident_priority==1 || incident_priority==2)
		{res = 1;}
	if(incident_priority==3)
		{res = 21;}
	if(incident_priority==4)
		{res = 31;}
return res;
};

 
The corresponding bucket ranges (the "res" value) are:

Severity 0/1/2 or Priority 1/2: 1-20

Severity 3 or Priority 3: 21-30

Severity 4 or Priority 4: 31-40

 

We are seeing an issue where some tickets with a Severity of 3 and a Priority of 4 are falling into the Severity 4 bucket, even though the check for Priority is only in the "if incident_severity == null" block. Why might this be happening?

0 REPLIES 0