How to Create a relative duration for the Below Requirement

Gokul Nath
Kilo Sage

Hi all,

We are in a requirement of creating a relative duration for the SLA definition.

Condition 1: If Case raised before 10AM, the SLA should be fixed on the same day 5:30 pm

Condition 2: If the Case is raised after 10AM and before 3PM, the SLA should breach by next day's 12PM

 

We are not sure how to implement this requirement and have created a new relative duration with the following code below

 

//if ticket received before 10am MY time, SLA due by same day 5.30pm MY time
var days = 1;
//1 business day and elapsed on same day by 5:30pm if requested before before 12am
if (calculator.isBefore(calculator.startDateTime, "10:00:00")) {
   //Elapsing on Same day at 5:30
calculator.calcRelativeDueDate(calculator.startDateTime,"17:30:00");
}
//if after 10 and before 3 next day by 12
else if (calculator.isAfter(calculator.startDateTime, "10:00:00") && calculator.isBefore(calculator.startDateTime, "15:00:00")){
 days = days+1;
//elapsing at 12:00
calculator.calcRelativeDueDate(calculator.startDateTime,days, "12:00:00");
}

The above Relative duration used is not working as it is expected to be.

Any suggestions on how to achieve this requirement would be most helpful.

1 REPLY 1

Gokul Nath
Kilo Sage

The requirement should also run only on business days. Encountering any holidays or weekends based on schedules should be considered. Hoping for any resolution on this.