Using metrics to track number of field changes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2019 10:43 PM
I've got a requirement (currently using London) which I believe is a simple use of metrics, however I'm not finding any relevant examples and I haven't done a lot with metrics yet so the answer isn't jumping out at me. Most of the examples revolve around reporting on a field change duration.
Requirement 1:
Report on how often someone is changing the Urgency field in any incident from Low to High or vice-versa. i.e. how many times a week is someone changing an incident in this way? A month?
Requirement 2:
Be able to breakdown the number of changed incidents by who is changing them
Any pointers would be greatly appreciated. Or better yet, steps I can duplicate in a development instance.
- Labels:
-
Performance Analytics
-
Reporting

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2019 04:58 AM
If you want to capture all changes to Urgency, you can just build a simple Field value duration metric like below:
If you want to capture only 1 -> 3, or 3 -> 1, then you will need to add a script to the Metric to check the value and if true, then capture the metric.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2019 09:26 AM
Michael,
Thanks for the response. Could you provide a bit of sample code for checking the urgency value and then capturing the metric? I've not found much in the way of relevant sample code.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2019 11:00 AM
Something like this should work:
if (current.urgency != '2')
createMetric();
function createMetric() {
var mi = new MetricInstance(definition, current);
if (mi.metricExists())
return;
var gr = mi.getNewRecord();
gr.field_value = true;
gr.calculation_complete = true;
gr.insert();
}