Can you please share how MTTR(between sys_created_on and resolved_at) is calculated in incident?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2025 04:19 AM
--> Create a field on incident form , field name : MTTR
And field type is : Time
--> When a incident is resolved , we need to caluculate the MTTR ( Mean time taken to Resolve)
Suppose a incident created at 14/03/2025 11:08:00AM
And Resolved at 14/03/2015 12:40:00PM
Mean time should populate : 48 minutes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2025 04:23 AM
Hi @neehas710
you have already created the MTTR field?
If som then go to system dictionary (right mouse button click) > system dictionary and there is "Calculated value" tab where you can write a script that would count this, but be careful to exclude non-working hours, weekends and holidays unless you want to have it in it..
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2025 04:27 AM
Hi @neehas710
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2025 04:28 AM - edited 07-14-2025 04:30 AM
Hi @neehas710 ,
Use below code in Server Script like Business rule, on before state changes to 'Resolved'
var duration = gs.dateDiff(current.sys_created_on.getDisplayValue(),current.resolved_at.getDisplayValue(),false);
current.setValue('u_mttr', new GlideDuration(duration)); // u_mttr should be duration type field
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
Thanks, GP