Duration field calculation

Vijaykumar K
Tera Contributor

Hi All, 

 

As a out of box we are having Resolve time (type is integer) after adding attribute ( glide duration) it will show time in day:hour:min format. Now I have a custom field on hold duration (type is duration) . So my request is how to calculate time difference between these two fields and push the out put another new field called MTTR(duration)

 

MTTR(duration)=resolve time (integer) minus Onhold duration (duration).

 

Pls help me how to do the above formula

*When to run is ticket state changed to resolved.

3 REPLIES 3

Sid_Takali
Kilo Patron
Kilo Patron

Hi @Vijaykumar K you need to use function field and need to use glidefunction:datediff(closed_at, sys_created_on) function. Refer this docs 

https://docs.servicenow.com/en-US/bundle/utah-platform-administration/page/build/platform-functions/...

 

Regards,

Siddharam

Vijaykumar K
Tera Contributor

Hi Siddharam, could you pls help me with the script. 

Sid_Takali
Kilo Patron
Kilo Patron

Hi @Vijaykumar K  make your MTTR field as function using function checkbox selection on dictionary entry and use this script in function definition field glidefunction:datediff(resolve_time, onhold_duration).

Refer below screenshot

SiddharamTakal_0-1686898544855.png

Please don't forget to mark reply Helpful/Correct, if applicable

Regards,

Siddharam