Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.
Versions
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store
Close

Example: Script mapping

Example: Script mapping

The Age breakdown uses the Incident.Age.Days script to calculate the age of incidents in days and map the values to the Incident Age Ranges bucket group.

Example

In the first two images, you see the Age breakdown, which uses the Incident.Age.Days breakdown source and the Incident.Age.Days script for breakdown mapping. You also see that the breakdown source refers to the Incident Age Range (Days) bucket group.
The age breakdown with Incident.Age.Days source and mapping highlighted
The Incident.Age.Days breakdown source showing the Incident Age Ranges bucket group

The Incident.Age.Days script takes the time stamp when the incident was opened from the incident table and subtracts this from the time stamp at the end of the collection period. The script converts this value from milliseconds to days.

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);

The resulting numbers of days are sorted into the buckets of the bucket group.

Incident Age Ranges bucket group buckets

Here is the result of running this script on the Number of open incidents indicator.

Detailed scorecard of the Number of open incidents indicator showing the Age breakdown