- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2016 03:41 PM
Hello,
Looking for some guidance on how to do this. The goal is to send a different email notification to incidents created after hours. The notification will basically say we will review incident next business day. Hoping to get some help on scripting this.
I would probably need to create the following. Unless if can recommend other way of doing it. Best practice???
Event to trigger notification
Business Rule
Notificaition
Thank You,
Edwin
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2016 01:21 PM
You will have to change this to send when an event is fired. Register a new event and change this notification to go out when that event is fired. In your existing business rule add an else condition
var sched = new GlideSchedule('sys_id of your schedule goes here');
var d = new GlideDateTime(current.opened_at);
if (sched.isInSchedule(d)) {
gs.eventQueue('event name',current,current.caller_id);
}
else{
gs.eventQueue('event name 1',current,current.caller_id);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2016 02:34 PM
Will do Abhi.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2016 02:30 PM
Hi Abhi,
The normal notification did not work, creating a new event and business rule. What happened was it just stop sending email notification during business hours. I am currently troubleshooting this.
Edwin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2016 02:43 PM
You do not need a new business rule. You can add else condition to the existing business rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2016 03:01 PM
Here's the updated BR.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var sched = new GlideSchedule('8b65551c6fae8500b3a2f941be3ee419');
var d = new GlideDateTime(current.opened_at);
if (sched.isInSchedule(d)) {
gs.eventQueue('incident.created.offhours',current,current.caller_id);
}
else
if (sched.isInSchedule(d)) {
gs.eventQueue('Incident.Created.BusHours',current,current.caller_id);
}
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2016 03:13 PM
use this
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var sched = new GlideSchedule('8b65551c6fae8500b3a2f941be3ee419');
var d = new GlideDateTime(current.opened_at);
if (sched.isInSchedule(d)) {
gs.eventQueue('incident.created.offhours',current,current.caller_id);
}
else
{
gs.eventQueue('Incident.Created.BusHours',current,current.caller_id);
}
})(current, previous);
Did you create a new event with name "Incident.Created.BusHours" and used that in the notification?