- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2017 03:04 AM
Hi All,
I require that when the additional comments on the sc_req_item change an email notification is sent to the person who is assigned to the task related to that item. I found an earlier post on here and tried to replicate the business rule and notification, but I'm not getting any email notification firing. Below is the business rule setup and email notification setup. Do I need to add somewhere to the notification the business rule that is being used?
I was also wondering if the sc_req_item has multiple tasks related to it, would this send a notification to the assigned to person on each task?
Any help as to where I've gone wrong is greatly appreciated.
Business Rule:
Email Notification
.
Email Template
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2017 11:19 PM
Hey Sam,
Sorry was caught up with my implementation specialist exam.
This is puzzling, the order of tasks shouldn't make any difference, can you please modify the BR as follows -
function executeRule(current, previous /*null when async*/) {
var email_to = [];
var sc_task = new GlideRecord('sc_task');
sc_task.addQuery('request_item',current.sys_id+'');
sc_task.addActiveQuery(); //eliminates the inactive/closed tasks, optimizes the results
sc_task.query();
while (sc_task.next()){
gs.log("sam1");
if (sc_task.assigned_to == "" || sc_task.assigned_to == null){ //included the null keyword as sometimes the system doesn't compare successfully with ""
gs.log("sam2 "+sc_task.assignment_group.manager);
email_to.push(sc_task.assignment_group.manager+'');
}
else{ //added an else to optimize the query
gs.log("sam3 "+sc_task.assigned_to);
email_to.push(sc_task.assigned_to+'');
}
}
gs.log("sam4 "+email_to);
gs.eventQueue("sc_req_item.commented.itil", current, email_to.join(), gs.getUserName());
})(current, previous);
I've just tweaked the logs and the email_to.push statement.
Please run all the 4 use cases and share the logs/results:
1. both tasks have assigned to
2. both tasks don't have assigned to
3. task 1 has assigned to & task 2 doesn't
4. task 2 has assigned to & task 1 doesn't
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2017 03:21 AM
I see the event name in your business rule is different from the notification.
Thank You
Please Hit Like, Helpful or Correct depending on the impact of response

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2017 03:22 AM
looking at this log, the event parm1 contains your name, so please check the 'send to event creator' checkbox on the notification and the notification should trigger just fine.
Thanks
Sakshi
P.S.: please mark helpful/correct based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2017 03:15 AM
Hello,
Your Business rule triggers 'ritm.commented' event and the event selected in the notification is different.
Both the event names should be same.
Best Regards,
Rajesh M.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2017 03:17 AM
Hi Sam,
The event name specified in the BR (ritm.commented) and the one specified in notification (sc_req_item.commented) don't match.
Also, make sure that if you are testing with your ID, i.e. the task is assigned to you and you are the one commenting on the RITM as well, check the 'send to event creator' checkbox on the notification.
Thanks
Sakshi
P.S.: please mark helpful/correct based on impact

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2017 03:19 AM
Also , to answer your other questions,
This business rule will trigger notifications to all tasks associated with the RITM, even the closed ones. To prevent that you can add a condition checking the state of the task.
Thanks
Sakshi
P.S.: please mark helpful/correct based on impact