Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Show different live chat initial agent response message based on time frame

Zhenhua_Yu
Tera Contributor

Live chat, support time is 8 Am to 5 PM EDT, and exclude US public holidays, if user try to contact live agent during non-Support hours, we need to give them a message like "This is a Off hours. Agent works from 8 AM till 5 PM EDT. If anything urgent then please reachout to 24 X 7 IT helpdesk"

 

How to achieve this?

1 REPLY 1

Lynda1
Kilo Sage

When chat is closed, we have a the below script checking the calendar that is attached to the queue.

Then a decision

Public - gives a holiday message

Weekend - gives the standard closed message we have.

 

This is the script we use,  obviously, you need to modify it to your calendar name.

 

 

(function execute() {
var g = new GlideRecord('cmn_schedule');
g.addQuery('name', 'U.S. Holidays - Chat Queues');
g.query();
if (g.next()) {
var sched = new GlideSchedule(g.sys_id);
var d = new GlideDateTime();
if(sched.isInSchedule(d)){
vaVars.public_holiday_check = "public";
//gs.info("Enjoy the Public Holiday");
}
else{
vaVars.public_holiday_check = "weekend";
//gs.info("Enjoy the Weekend");
}
}
})()