Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Create report on Incidents upgraded to P1 or downgraded from P1 to lower Priority

MP7
Kilo Contributor

Hello ALL,

I need to create a report -specific to any Incidents upgraded to P1 or downgraded from P1 to something else

I did the following:

1. I created Metric Report>Metrics --> Definitions --> New
with the following criteria
See screen shot

find_real_file.png

2. Created new Report using Incident Metric Definition=Priority
See screen shot

find_real_file.png

 

How can I narrow this report to show upgrades to P1 or any downgrades of P1?

find_real_file.png

thanks much

 



4 REPLIES 4

Tony Chatfield1
Kilo Patron

Hi, the metric data you are recording is the current priority of a task, not a change in priority.
The metric definition functionality has access to the 'current' task record but I don't think you can get 'previous' values so may not be able to record 1 entry per priority change (at least not without a bit of messy scripting) .

A simple fix would be a custom text field on your task table and a before BR that sets a string IE
'Priority Upgraded to P1 from P3', you could then generate metrics for this new field.

 

Sharath Allam
Tera Contributor

Hi,

Add a flag(Boolean type) field to an incident table and write a business rule 'after update' that sets the flag when 'priority' changes from "P1 to any" or "any to P1".

Then create a report where it shows only records whose flag is set.

Field: Flag

Type: Yes/No

Business Rule:

When: After Update

Condition: Priority Changes

Script:

current.flag=false;

if ( (previous.priority == 1 && current.priority > 1) || (previous.priority > 1 && current.priority == 1 ))

{

    current.flag=true;

}

 

Report:

Select type of report you want.

Filter:

Active is True

Flag is True

 

If you want to show priority upgrade incidents and downgrade incidents separately, then change the flag type to int and set 1 for upgrade and 2 for downgrade and 0 otherwise.

 

current.flag=0;

if((previous.priority > 1 && current.priority == 1 )

    current.flag=1;

else if( (previous.priority == 1 && current.priority > 1)

   current.flag=2;

 

Report condition:

flag is not 0

group by flag

 

Please mark as 'Accepted Answer' if this solves your requirement.

 

Thank you,

Sharath Allam,

Kaptius - ServiceNow Premier Partner.

Sharath Allam
Senior Lead Consultant, Kaptius

Eddie5
Tera Contributor

Hi all,

 

Please create report as per below screenshot, mark this answer useful if this helps.

Eddie5_4-1675166811587.png

 

 

 

@Eddie5 , reporting on core system tables may result in platform performance issues and this is not a best practice solution. The appropriate approach is to record the data as a metric, or via additional table field and report against this.