This article is a supplement to the ServiceNow documentation. For full documentation please refer ServiceNow official website
Checkout our NEW Video Channel you can like and subscribe too!


Buckets are used when we have to create breakdown source for non-category data such as Age,Date,Percent etc.

Bucket groups are used to create a special breakdown source that we can use in a breakdown with a scripted mapping. A bucket group divides the range of values that the script returns into discrete buckets.

For example, Say we have a script that calculates the age of records in the incident table and a bucket group that divides those ages into <1 day, 2–5 day, 6–30 day, and 30+ day buckets. If we have a breakdown that uses this bucket group and script, and we can use this breakdown with the Number of open incidents indicator, currently open incidents are sorted into these age buckets.

Attributes such as Priority ,State and Assignment Group have a finite set of values and referred to as category. Attributes such as Age,Cost,percent Complete are continuos as their values can be any number within a given range.

Continuous attributes cannot be used as breakdowns.The solution is bucket groups. A bucket group organizes non-categorical data (continuous data) in categories

Steps to create Bucket Groups:

  1. Navigate to Performance Analytics > Breakdowns > Bucket Groups. bucketgroup1297.PNG
  2. Click New. bucketgroup2297.PNG
  3. Enter a Name that clearly identifies the bucket group
  4. Double-click Insert a new row to add a new bucket.
  5. Enter a Name for the first bucket, then press Enter or click the green check icon.
  6. Double-click in the Start and End columns to enter the starting and ending values for the range.
  7. Records that match the end value are excluded from the bucket. Therefore, set the end value of one bucket and the start value of the next bucket to be the same. Records that exactly match that value are sorted into the bucket that has that value as the start value.
  8. Click Submit after all the bucket ranges have been defined. bucketgroup3297.PNG bucketgroup4297.PNG

Create a Break down Source:

Create a breakdown source that uses the Bucket pa_buckets facts table, the Sys ID field, and the condition

[Bucket group][Is][<the name of the bucket group we created>]. 


Create a Break down:

  1. Create a breakdown that uses this breakdown source and uses the relevant script for the breakdown mapping bucketgroup10297.PNG bucketgroup7297.PNG
  2. Click on i Option to open the mappings bucketgroup8297.PNG
  3. Click on i to open the script. bucketgroup9297.PNG
  var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};
  var days=function(x,y){return diff(x,y)/(24*60*60*1000);};
  days(current.opened_at, score_end);


Read More