- 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 12:47 PM - edited 05-01-2023 06:28 PM
Hi SandyL83,
Is the 'u_time_assigned' field a Date/Time field? Your script looks good. Is there a condition defined on the BR? Maybe add:
gs.addInfoMessage("BR previous.assigned_to = " > previous.assigned_to + ", current.assigned_to = " + current.assigned_to + "."); before you "if" statement and test, a message will be added.
On Insert, 'previous' object will be undefined, You may want to run that BR on Update too, if there is no assigned_to value when the incident is created.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 05:31 AM
Thank you!!!!! Changing it to "Update" did the trick! As always, you rock!