Disabling Live Chat Depending On Business Opening and Closing Times

dalejaurigue11
Tera Expert

Hi SN Community,
I have a requirement to enforce closing and opening times of agent chat. Is there a way to enforce disabling of live chat if past business hours? (e.g. Business hours is 9AM - 5PM then the chat will be disabled outside these times).
Or is it possible to make agents unavailable at these times? Thanks.

3 REPLIES 3

Royce Blackbour
Giga Contributor

Hi dale11,

 

A little something like this should do the trick:

 

(function execute() {
    var gdt = new GlideDateTime();
    var qldTimeOffset = new GlideTime();
    qldTimeOffset.setValue("10:00:00"); // for local time at IT
    gdt.add(qldTimeOffset);
    var qldTime = gdt.getTime();

    var openingHour = new GlideTime();
    openingHour.setValue("06:00:00");

    var closingHour = new GlideTime();
    if (gdt.getDayOfWeekUTC() == 6 || gdt.getDayOfWeekUTC() == 7) {
        closingHour.setValue("18:00:00"); // weekends
    } else {
        closingHour.setValue("19:00:00"); // weekdays
    }

    if (qldTime.before(openingHour) || qldTime.after(closingHour)) {
        vaVars.within_opening_hours = "no";
    } else {
        vaVars.within_opening_hours = "yes";
    }  
})()

Then don't allow the "vaSystem.connectToAgent()" unless its within the right time period.

Kind regards,

Royce.

Muralidharan BS
Mega Sage
Mega Sage

Hi There,

If you are using the OOB Advanced work assignment, then go to the queues and add a schedule. If the schedule is past then users get a no agents msg. 

find_real_file.png

Thanks

Hi Murali,

Thanks for your response.

I tried utilizing this schedule function but I am having an issue with the routing. When I enable this even though the current time is still within the schedule the interaction is not getting generated in the queue work item thus not showing in the agent's inbox.