Performance Analytics - group incidents by category & subcategory

Magda6
Tera Expert

Hello,

I need to prepare a dashboard where incidents must be divided into multiple groups based on their categorization (e.g. if Category = A and Subcategory = B, then it's Type 1 incident, if category = A and Subcategory = C it's type 2 incident etc.). Is there a way to create buckets based on the value from multiple fields? Can it be done through scripting?

I know that this can be achieved by adding a new field in the incident table but this is something I'd like to avoid.

1 ACCEPTED SOLUTION

Josh Cooper
ServiceNow Employee
ServiceNow Employee

Good afternoon!  

Raghu is PARTLY right.  Bucket groups ARE meant for numeric data, but it's still possible to use in your situation as well.  In the script that you use for the bucket group, just return the number of the category you want.

For example:  Type 1 is bucket from 0 - 1, Type 2 is from 1 to 2, Type 3 from 2 to 3, etc... making your standard numerical bucket groups.

Then, in the script where you would normally calculate the number for the bucket group, just set it to group you want.

e.g.
var chooseBucket = 0;
if (current.category == A && current.subcategory == B) {
    chooseBucket = 1;

return chooseBucket;

etc.

Make sure to put a comment in your script that explains 1 = Type 1, 2 = Type 2, 3 = Type 3, to make it clear for the next person what's going on.

 

Or, as Raghu suggested (with a bit more information), you can use a manual breakdown for Type 1, Type 2, Type 3, and use a breakdown mapping script to put it where you want it.  There are some examples out of the box that show how it's done, but breakdown mapping script wants the return value to be the sys_id of the breakdown choice.

View solution in original post

2 REPLIES 2

Raghu Ram Y
Kilo Sage

Hello @Magda 

Buckets supports only numeric data, so you can't achieve it through the buckets..

My suggestion is to use breakdowns... using breakdown you can achieve your requirement..

Josh Cooper
ServiceNow Employee
ServiceNow Employee

Good afternoon!  

Raghu is PARTLY right.  Bucket groups ARE meant for numeric data, but it's still possible to use in your situation as well.  In the script that you use for the bucket group, just return the number of the category you want.

For example:  Type 1 is bucket from 0 - 1, Type 2 is from 1 to 2, Type 3 from 2 to 3, etc... making your standard numerical bucket groups.

Then, in the script where you would normally calculate the number for the bucket group, just set it to group you want.

e.g.
var chooseBucket = 0;
if (current.category == A && current.subcategory == B) {
    chooseBucket = 1;

return chooseBucket;

etc.

Make sure to put a comment in your script that explains 1 = Type 1, 2 = Type 2, 3 = Type 3, to make it clear for the next person what's going on.

 

Or, as Raghu suggested (with a bit more information), you can use a manual breakdown for Type 1, Type 2, Type 3, and use a breakdown mapping script to put it where you want it.  There are some examples out of the box that show how it's done, but breakdown mapping script wants the return value to be the sys_id of the breakdown choice.