Disabling Live Chat Depending On Business Opening and Closing Times
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 01:10 AM
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.
- Labels:
-
Agent Chat
-
Virtual Agent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 11:50 PM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2022 12:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 09:34 PM
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.