Notification not sent when customer adds comment to RITM – no email record created

ItayB
Tera Contributor

Hello Community!

I'm working on a requirement where a notification should be sent to the Assigned to user of an open Catalog Task (sc_task) whenever the Requested for user adds a comment in the Additional comments field on the parent Requested Item (sc_req_item).

 

This is my mission:

"Create a notification (content of the notification will be described below) that is sent to the proponent of an open task (Assigned to of the Catalog task) when the client (Requested for) writes a response in the Additional comments of the request.
Notes:
● If there is no proponent: the notification will be sent to the members of the proponent group (assignment group).
● If there is more than one open task: the notification will be sent to proponents of all open tasks."

 

I did Notification, Event, and Business Rule for this mission but when i go to "Email Logs" i dont see any email sent.

Picture of Event:

ItayB_0-1751794467775.png

 

Pictures of BR:

 

ItayB_1-1751794508495.png

 

 

ItayB_2-1751794534539.png

 

Pictures of Notification:

 

ItayB_3-1751794600819.png

 

ItayB_4-1751794616702.png

 

ItayB_5-1751794638655.png

 

 

In addition i add the system logs:

 

ItayB_6-1751794800762.png

 

 

Thank you All ! 

1 ACCEPTED SOLUTION

S Goutham
Tera Guru

Hi @ItayB 
1. I noticed the event you have registered is "sc_req_item.notification.itil" and the event called in the BR is "custom.client.comment.notification"
2. In your BR, please move the condition to check the additional comment change to when to run tab 

SGoutham_0-1751799450688.png


3. As you have the notification referring to sc_request_item, and you need to send the email to the task assignment group, which you will not be able to dot walk, so you need to send the group DL email address /sys_id in the event parameter of the BR refer to the script shown below

	if (current.sys_updated_by == current.requested_for.user_name) { //check if the latest comment added is by requested for
	    var taskgrp = [];
	    var taskGr = new GlideRecord('sc_task');
	    taskGr.addQuery('request_item', current.sys_id);
	    taskGr.addQuery('state', 'NOT IN', '3,4,7');
	    taskGr.query();
	    while (taskGr.next()) {
	        taskgrp.push(taskGr.assignment_group.email.toString()); //pushing all the active assignment group email id's
	    }
	    //syntax gs.eventQueue ('<event name registered'>,' <gliderecord of the notification table>','event param 1<optional>','event param 2 <optional>');
	    gs.eventQueue('sc_req_item.notification.itil', current, taskgrp);
	}

Hope you have verified if the task group records have email id's, if not push the group sys_id's

taskgrp.push(taskGr.assignment_group.sys_id.toString());

Do the above changes and try to trigger the email and check them in the email logs




  



I hope this solves your issue
Mark this as Helpful / Accept the Solution if this clears your issue

View solution in original post

13 REPLIES 13

No, I don't want you to remove it but I want you to pass the recipient from BR instead of passing comments. 

I dont understand what you mean bro.. 

Hi @ItayB,
-------------------------------------------------------------------------------------------------
You're almost there — just a small adjustment needed in your configuration.

In your Business Rule, you're using:


In BR you mentioned-:

gs.eventQueue('event.name', GlideRecord, parm1, parm2);

From what I see in your Notification record, you've checked the box indicating that Param 1 contains the recipient. However, in your script, Param 1 is set to current.comments... and Param 2 holds the record's sys_id.

To properly send the notification to the intended user, either Param 1 or Param 2 should contain the recipient's email address (depending on which checkbox is selected in the Notification setup).

So in your case, make sure:

  • Param 1 has the email address if you're using "Param 1 contains recipient", or

  • Param 2 has the email address if you're using "Param 2 contains recipient".

Update the script or the Notification configuration accordingly, and it should work as expected!
---------------------------------------------------------------------------------------------------------------------

If this helps, please mark it as Helpful and Accept as Solution. Let me know if you need further guidance!

Thanks & Regards
Mayank

 

Mohammad Danis1
Giga Guru

Hi @ItayB ,
Please update your BR script at line number 16 as below:

gs.eventQueue("custom.client.comment.notifiction", taskGr, taskGr.assigned_to,current.comments.getJournalEntry(1));


Regards,
Mohammad Danish

S Goutham
Tera Guru

Hi @ItayB 
1. I noticed the event you have registered is "sc_req_item.notification.itil" and the event called in the BR is "custom.client.comment.notification"
2. In your BR, please move the condition to check the additional comment change to when to run tab 

SGoutham_0-1751799450688.png


3. As you have the notification referring to sc_request_item, and you need to send the email to the task assignment group, which you will not be able to dot walk, so you need to send the group DL email address /sys_id in the event parameter of the BR refer to the script shown below

	if (current.sys_updated_by == current.requested_for.user_name) { //check if the latest comment added is by requested for
	    var taskgrp = [];
	    var taskGr = new GlideRecord('sc_task');
	    taskGr.addQuery('request_item', current.sys_id);
	    taskGr.addQuery('state', 'NOT IN', '3,4,7');
	    taskGr.query();
	    while (taskGr.next()) {
	        taskgrp.push(taskGr.assignment_group.email.toString()); //pushing all the active assignment group email id's
	    }
	    //syntax gs.eventQueue ('<event name registered'>,' <gliderecord of the notification table>','event param 1<optional>','event param 2 <optional>');
	    gs.eventQueue('sc_req_item.notification.itil', current, taskgrp);
	}

Hope you have verified if the task group records have email id's, if not push the group sys_id's

taskgrp.push(taskGr.assignment_group.sys_id.toString());

Do the above changes and try to trigger the email and check them in the email logs




  



I hope this solves your issue
Mark this as Helpful / Accept the Solution if this clears your issue