Can you please share how MTTR(between sys_created_on and resolved_at) is calculated in incident?

neehas710
Tera Contributor

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

3 REPLIES 3

GlideFather
Tera Patron

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..

KamilT_0-1752492191378.png

 

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @neehas710 

 

https://www.servicenow.com/community/itsm-forum/mttr-calculation-for-resolved-closed-ticket/m-p/5089...

 

*************************************************************************************************************
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]

****************************************************************************************************************

G Ponsekar
Mega Guru

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