Response time KPI – Currently, the response time is including the hours post 6pm (out of working hours). Need to update the calculations such that response time is based on the working hours Monday to Sunday, 9am to 5pm. For example, if an enquiry comes in after 5pm, the response time should only be calculated from the next day 9am onwards.
id = id[Response Time == null];
if (time(id.get("Received Time")) >= time("09:00:00") and time(id.get("Received Time")) <= time("17:00:00"))
{
id.put("Response Time", id.get("Received Time"));
}
else
{
next_day = dateAddDays(date(id.get("Received Time")), 1);
response_time = dateAddHours(date(next_day), 9);
id.put("Response Time", response_time + time("00:00:00"));
}