How duration field is being calculated in the incident form?

Ksnow
Tera Contributor

Hello all, @shloke04 @Ankur Bawiskar @Dan H 

Can anyone explain me how duration field calculated in the incident form ? provide an example to understand better.

I have referred a few docs and it wasn't clear for me. If possible please explain Business duration, Business resolve time and resolve time as well.

Also is there any field from above which will exclude on hold time of the incident?

Appreciate your help!

Thank you very much in advance.

 

1 ACCEPTED SOLUTION

@Ksnow 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

7 REPLIES 7

@Ksnow 

Did you get a chance to check on the link I shared?

It has detailed explanation

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ksnow 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

shloke04
Kilo Patron

Hi @Ksnow 

There are two Duration fields on Incident which are "Business duration" and "Calendar duration". Both Duration fields are calculated by the OOB business rule "mark_closed" on the incident table. 

These are the following code in the business rule: 

if (dataChange || current.business_duration.nil()) 
current.business_duration = gs.calDateDiff(opened, closed, false); 

if (dataChange || current.calendar_duration.nil()) 
current.calendar_duration = gs.dateDiff(opened, closed, false); 

Both Duration fields are actually calculated based on incident opened time and incident closed time only.

It is clear that duration for incident is calculated based on incident opened time and incident closed time only.

It is calculated regardless what states incident has ever been set to. The duration of incident is simply the time difference between incident opened time and incident closed time. Putting incident in "Awaiting User Info" state would definitely affect the duration for the incident because the pause period would be counted into the duration in this case.

Example

Incident create time: 3pm
Put incident into Awaiting User Info time: 4pm
Change incident state back to Active: 5pm
Close incident: 6pm

 

For this example, the duration of the incident would be 3 hours because it is created at 3pm and is closed at 6pm.

The points above are documented clearly by ServiceNow which explains this pretty well. Please refer the same below:

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0754082#:~:text=The%20duration%20of%20incident%20is,time%20and%20incident%20closed%20time.

https://docs.servicenow.com/bundle/sandiego-platform-administration/page/administer/time/concept/c_ResolveTime.html

https://community.servicenow.com/community?id=community_question&sys_id=bdf887a1db5cdbc01dcaf3231f9619a5

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

 

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke