The CreatorCon Call for Content is officially open! Get started here.

SLA's & Business Days

david_walters
Mega Expert

The out of the box relative duration 3 business days by 4pm, I take this to mean that a record created on a Thursday at 9:48 am should show has having 3 days left in the Business Time Left field. However, it shows the business time left as 1 day 11 hours 17 mins.

This implies to me that the "days" in the relative duration are days regardless of the type, i.e. there is no distinction between business days as defined in the schedule and real 24 hour days.

Defining Relative Durations - ServiceNow Wiki states that "Business days have the same 24-hour duration as calendar days unless a schedule is defined". I am using a schedule.

So, why does the business time left field show as 1 day 11 hours 17 mins rather than 3 days?

Here's the duration that's being used:

--- start ---

// 3 business days by 4pm if before 10am

var days = 3;

// If the current time is after 10:00, add another day

if (calculator.isAfter(calculator.startDateTime, "10:00:00")) {

    days++;

}

calculator.calcRelativeDueDate(calculator.startDateTime, days, "16:00:00");  

--- end ---

and I've attached some screenshots to show what else is in use.
8 REPLIES 8

rob_blakey
Tera Expert

As a note, If your Schedules are say from 09:00 - 17:00 (8 hours) and your SLA is 3 days. then it will show as 1 day 0 hours 0 minutes.


Something I had to do to fix the SLA's rather than using days was setup the schedules (in my usecase see below)



The Priority 3 Request SLA/Duration time is changed from 5 Days to 1 Day 16 Hours
Calculation: 5 x 8 hours (1 day = 3x 8 Hour Blocks + 2x 8 Hour blocks) = 1 Day 16 Hours


Thanks, Rob.



I think the problem is that I'm looking at "Business time left" and thinking about that in real terms. What I should really be doing is thinking that that countdown is only against the times available in the schedule. A more realistic view is to take the "Actual time left", that's a better indicator of how much time we actually have before the SLA is breached.



So, perhaps this isn't real problem, just something that's not very clear.



Thanks both for your help.


Great catch!   Worked for me Rob.


While I understand Rob's calculation, I have users that want it to read as 5 Days.



The business day is 8 hours, they don't want to see 1 day that is equal to 3 days.


They want to see that 8 hours equals 1 day.



I can't use Actual time duration because then that would include weekends and holidays.