Duration field 1 day = 8 hours

march
Kilo Guru

Hi Community

 

We got the requirement from our Development Team to have new duration field added.

Until there no Problem.

 

The point is that they want 1 day = 8 hours

ie: when a user enter 10 hours, SNOW display that as 1 day and 2 hours.

But also that when we for example do an excel report the exported value of a record with a duration of 1 day and 2 hours is not (24+2)*60*60=93600, but (8+2)*60*60=36000


Is there an existing attribute allowing to control this? Or do we have to play with the stored value using Business Rules?


Thanks

Marc.

11 REPLIES 11

march
Kilo Guru

Anyone having an idea?


There is an attribute that you can add to a field that is max_unit=hours.   It does not solve your problem, but may help.


randrews
Tera Guru

so.. if i am understanding what you want.. it is a duration field that invokes a calender.. basically a business duration.



if so.. then it shouldn't be two hard but you would have to setup a calender for the...



if not you are going to need to use a calculated duration field but not sure exactly how to get that.. i believe you would need to use a function to first convert the duration to milliseconds then divide it by [8(hours per work day) * 60(minutes per hour) * 60(seconds per minute) * 1000(milliseconds per second)] that should give you the business days...



then multiply the result by [24 (hours per day)   * 60(minutes per hour) * 60(seconds per minute) * 1000(milliseconds per second)]



then use a function to set the duration field to the millisecond value.. I have forgotten the exact function to convert a duration field to milliseconds but am pretty sure it is in the wiki.




now that i look at the math involved you can just use a calculated duration field.. and multiply the actual duration by 3...



keep in mind this will NOT account for holidays and weekends.. so i personally think you would be better getting back and asking more WHY questions.. i suspect they want a calender based duration field that skips weekends and holidays


Hi,



We have the same issue over here. Not a question of SLA, but of "Effort capture" for developers.


They typically work in days (of 8 hours), but some development (especially in ServiceNow 🙂 require less than 1 day. Therefore, we wanted to use the duration field, so that some developers could enter their time in days, and some others in hours.


But using the duration field this might lead to confusion - as 3 days of effort, i.e. 3x8hours = 24 hours, would be displayed as 1 day.


We use fields to be filled in days, and ask developers to enter 0.5 or 0.25 if time required is less. Anybody else, any good idea?