Display Business Elapsed Time in hours only

Harry Campbell2
Mega Guru

Hi Everyone,

Is there any way to display the Business Elapsed Time in Hours only, as an example:

Instead of: 2 Days 3 Hours 14 Minutes

It would show this instead: 51 Hours 14 Minutes

I just think that the way it is displayed at the moment is far too misleading and trying to explain it to every user that asks is a struggle and they never fully understand.

If an SLA Duration is 4 Days and the Schedule is 08:00 - 18:00 then I see it like this:

Day 1: 10 Hours

Day 2: 10 Hours

Day 3: 10 Hours

Day 4: 10 Hours

That's 40 Hours, but is displayed as 1 Day 16 Hours - But has actually been running for 4 Business Days - when users see 1 Day 16 Hours, it just completely confuses them. Either displaying as 4 Business Days or 40 Hours is much more user friendly and I personally think SLA's & Schedules is something that ServiceNow really needs to work on.

Any help/advice would be greatly appreciated.

Many Thanks

Harry

1 ACCEPTED SOLUTION

Harry Campbell2
Mega Guru

After a lot of searching I have found this which does exactly what I wanted:



It's Now or Never - A hitchhikers guide to ServiceNow and it's universe: Display duration in hours i...



All I had to do was configure the dictionary entry for the Business Elapsed Time field & add max_unit=hours to the attributes.



Now this field only displays in Hours/Minutes/Seconds.




View solution in original post

6 REPLIES 6

Abhinay Erra
Giga Sage

Harry,



You can use gs.dateDiff() and get your time difference in seconds and then convert it to hours. Can you paste your code which is generating this elapsed time.


Hi Abhinay,



I'm not really sure where to find the script that generates this, it is a duration field on the Task SLA table.


Harry,



You can use dateNumericValue() to convert it into milliseconds and then divide the result by 3600000 to get number of hours


Here is the usage of it. "current" is my GlideRecord


current.duration.dateNumericValue()/3600000;





Thanks,


Abhinay




PS: Hit like, Helpful or Correct depending on the impact of the response


This doesn't seem to be working, whereabouts did you set that?