- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-17-2022 05:54 PM
Hello,
I'm looking far a solution to a request that came up. I'm looking to create some type of "Business hour" greeting for VA. Something where if the current time is outside of 7am-5pm a greeting would let the users know that no IT is staffed and that a ticket may sit unassigned until the next morning. If inside those hours it just goes about its normal greeting.
Has someone done this before? can this be done with a Script Action and Decision on the greeting flow in Designer?
Thanks for any advise,
Robert
Solved! Go to Solution.
- Labels:
-
Virtual Agent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-17-2022 10:22 PM
create your own Topic for greetings and add it in the Configuration record.
check the current date/time of user's locale and if it falls outside then show message
1) Create new topic
2) Script: Use Text Bot Response and add script in Response message
(function execute() {
var gdt = new GlideDateTime();
var message;
var localTime = gdt.getDisplayValue().toString().split(' ')[1];
var hour = localTime.split(':')[0];
if(hour > 17 || hour < 7){
message = 'no IT is staffed and that a ticket may sit unassigned until the next morning';
}
else{
// your normal greeting message
message = 'Hi ' + [vaInputs.user.name] + ', my name is Chatbot and I am your virtual agent. How can I help you today?';
}
return gs.getMessage(message);
})()
3) Publish that topic and then link it here under Custom Greetings and Setup module record
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-17-2022 10:22 PM
create your own Topic for greetings and add it in the Configuration record.
check the current date/time of user's locale and if it falls outside then show message
1) Create new topic
2) Script: Use Text Bot Response and add script in Response message
(function execute() {
var gdt = new GlideDateTime();
var message;
var localTime = gdt.getDisplayValue().toString().split(' ')[1];
var hour = localTime.split(':')[0];
if(hour > 17 || hour < 7){
message = 'no IT is staffed and that a ticket may sit unassigned until the next morning';
}
else{
// your normal greeting message
message = 'Hi ' + [vaInputs.user.name] + ', my name is Chatbot and I am your virtual agent. How can I help you today?';
}
return gs.getMessage(message);
})()
3) Publish that topic and then link it here under Custom Greetings and Setup module record
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-21-2022 09:01 AM
This was very helpful and I got it working with my greeting. Two new issues I wasn't thinking about is now giving me issues. Timezones and weekends. I'm looking into ways to display the greetings based on timezone or if the day is either Saturday or Sunday.
If you have any pointers let me know. If not, what you gave me has already helped.
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-21-2022 07:18 PM
Glad to know.
Please mark my response as correct and close the thread.
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-21-2022 07:19 PM
you can check if it's saturday or sunday like this
var gdt = new GlideDateTime();
var dayOfWeek = gdt.getDayOfWeekLocalTime();
if(dayOfWeek == 6){
// saturday
}
if(dayOfWeek == 7){
// sunday
}
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader