- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2019 09:44 PM
Could you please help finding out where I am going wrong and how can I generated this notification?
I want to generate an email notification when any update is made to the incident in the closed state.
Here is my inbound email action (Please ignore the debug statements)
if(current.state == "7"){
gs.info('New condition satisfied, email received for closed ticket. Firing the event incident.updated.when.closed');
gs.eventQueue("incident.updated.when.closed",current, gs.getUserName());
gs.info('Event firing done');
}
In my notification who will receive it section, Event parm 1 contains recipient, Event parm 1 contains recipient, Send to event creator are checked.
I checked the system logs and found this which is expected.
Processed 'Update Incident (BP)', updated incident :INC0117787
New condition satisfied, email received for closed ticket. Firing the event incident.updated.when.closed
Event firing done
The event logs also have the expected logs:
However, the notification is not going out. I cannot see the notification in outbox(as email sending is disabled for dev instance).
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2019 10:45 PM
Hello Sanjiv,
I found what the problem was. When I send an email to my instance for a closed incident, the additional comments or work notes are updated and it is generating the event incident.updated which also has a notification email set up. Turns out that the recipients for both the notifications were same(me). I made below changes to the Inbound email action:
var sender = email.from.toLowerCase();
gs.eventQueue("incident.updated.when.closed",current, sender);
And my notification now has only Event parm 1 contains recipient and send to event creator checked, not Event parm 2 contains recipient.
I did these changes and the correct notification is now generating.
What I find weird, is that both of these notification have weight as 0 and in this case, ServiceNow should not skip/ignore notifications even if the recipients and target records are the same. Could you please shed some light on this?
Thank you once again for your help regarding this.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2019 10:53 PM
I think, it should still work.
We were probably not sending the right values in the event. Instead of sysid, we should have passed the email id of the user. I think the below should work.
gs.eventQueue("incident.updated.when.closed",current,gs.getUser().getEmail())
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2019 11:49 AM
Hey Sanjiv,
Thank you for your suggestions. I checked passing the correct values in the event, however, it was still not working. Looking like there is a lock between two notifications.
Anyways, I figured it out with the changes I mentioned above.
Thank you once again for your response, Sanjiv.