Event Triggered Email Notification Not Sending

alexkcha
Kilo Contributor

I have two web services used to create incidents.   Each service uses a web service transform map to call the same event in an onAfter script.   The event will cause an email notification to be sent.   I am running into an odd issue where the email notification is sent from one of the web services but not from the other.   I will try to describe my setup below:

Event

Name: incident.created.webservice

Table: Incident

Email Notification

Name: Incident Created Web Service

Event Name: incident.created.webservice

Sends When: Event is fired

Who Will Receive: Event parm 1 contains recipient

Web Service

Name: WsAlpha

Transform Map: WsAlphaTransformMap

WsAlphaTransformMap contains an onAfter script with the following:


gs.eventQueue('incident.created.webservice', target, group.sys_id, gs.getUserName());

Name: WsBeta

Transform Map: WsBetaTransformMap

WsBetaTransformMap contains an onAfter script with the following:


gs.eventQueue('incident.created.webservice', target, group.sys_id, gs.getUserName());


Scenario

When WsAlpha receives a request, an email notification is sent after the incident is created.   I can see in the logs where the event is called and triggers the email notification to be sent.  


When WsBeta receives a request, the event is called after the incident is created.   However, an email notification is never sent.   I don't see any warnings/errors in the system logs.   I have found that an email notification is sent after changing the 'parm 1' parameter from group.sys_id to group.email.  


gs.eventQueue('incident.created.webservice', target, group.email, gs.getUserName());


I am puzzled because the two web service transform scripts are calling the same event (also calling the same email notification as a result), but the results are different.   Any kind of assistance would be greatly appreciated.  

9 REPLIES 9

jose_valle
ServiceNow Employee
ServiceNow Employee

Hi Alexander,



For WsBeta, do you see the sys_email record getting created? If not, you will first want to enable the property "glide.email.notification.save_when_no_recipients". However, if the sys_email record is getting created, you should be able to see a reason why the email failed to send to the group in the email log related list on the sys_email record.


Thanks,


-Jose


Abhinay Erra
Giga Sage

Alex,



Use group.getValue('sys_id') instead of group.sys_id and see if it works.


Mihir Mohanta
Kilo Sage

Check the notificaion you have configured.



"send to event creator" checkbox should be checked.




Thanks,


Mihir


That is not mandatory, we will check this check-box, if you want to send a notification to who ever triggered this event. But Alex is setting the recipient from event parm1