- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2023 07:57 AM
Hello,
I am trying to create a metric to measure the time from when an incident is assigned to a person (incident state changes to "Assigned") and the time the incident is Resolved (incident state changes to Resolved).
I have the following code, but it seems to me measuring from open to resolve, not assigned to resolved.
(Resolved= -3, Assigned is -3). Any ideas?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2023 08:16 AM
Hi @SandyL83 ,
You can refer this https: //www.servicenow.com/community/itsm-forum/incident-metric-calculate-time-between-first-assigned-to-unt...
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
Regards,
Ranjit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2023 08:16 AM
Hi @SandyL83 ,
You can refer this https: //www.servicenow.com/community/itsm-forum/incident-metric-calculate-time-between-first-assigned-to-unt...
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
Regards,
Ranjit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2023 08:26 AM
Hi SandyL83,
I suggest you look at the OOB metric defined for the 'incident' table and the 'incident_state' field named "Create to Resolve Duration". I do not have a choice value for 'incident_state' that is "Assigned". The script for that metric definition is:
// variables available
// current: GlideRecord - target incident
// definition: GlideRecord - (this row)
var s = current.incident_state;
if (s >= 6)
createMetric();
function createMetric() {
var mi = new MetricInstance(definition, current);
if (mi.metricExists())
return;
var gr = mi.getNewRecord();
gr.start = current.sys_created_on;
gr.end = current.sys_updated_on;
gr.duration = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue());
gr.calculation_complete = true;
gr.insert();
}
You can see the start value here is the 'created_on' field, so I suspect you need a "assigned_on" field to use a metric. Others here may have another suggestion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2023 08:31 AM
And I see that is confirmed in the Accepted answer to the post Ranjit posted. You'll need a business rule to set the custom field that stores when the incident is assigned.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2023 12:30 PM
Hello, thank you!
I created a custom field to capture when the incident is assigned (u_time_assigned).
then, I set up this Before, Insert Business Rule.
However, it's still not setting that field. Any ideas on what I have wrong?