Event being fired but email notification not being created

int123
Kilo Contributor

I have an event that is triggered through a run script activity in a request item workflow. The event is fired correctly and i can see it in the event logs.

I also have an email notification created to send whenever the event is fired with no other conditions. The subject and body also have just "test" written in them.

The email notification is not being triggered, I can see in the logs the other emails that get sent for the requested item such as "request item has been opened on our behalf" and "approval request" emails. However, this one notification that requires this event to be triggered does not work.

1 ACCEPTED SOLUTION

Yes, I understand what the problem is, I just wanted to get more information, which you're revealing now.

So taking in to account the 4 things you listed above...we can then try:

1) Is this notification actually "active"?

2) Is there a condition in the notification (so not only the event firing but a condition set) if so...what is that?

3) For Parm1, while you can use email address...I'd recommend just passing the user's sys_id, so current.request.requested_for instead

4) You've said the notification isn't sending, but are you sure? Have you checked sys_email logs to see that it's not going out and perhaps just going to a spam folder or something?

5) Double-check the event you've specified for this notification to ensure it's really set to: 

createItemNotification

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

21 REPLIES 21

Sorry! I am still getting used to this platform and don't really know what information to give for troubleshooting.

Here is my run script that is being used in the workflow. At first I had the "current.request.requested_for.email" being passed as parm1 but I have removed it and for testing purposes, placed my email as the "who will receive" user just to make sure the notification works.

 

//Get the array that contains the sys_id's of all the notify steps we need
var notifysteps = workflow.scratchpad.notify_steps;

//Fill in the task values based on the task step
while(notifysteps.length > 0){
	//Create a GlideRecord for the step at the end of the list then pop it's sys_id off the end
	var workflowStepGR = new GlideRecord('u_workflow_steps');
	workflowStepGR.get(notifysteps.pop());
	
	//Generate the createItemNotification event
	gs.eventQueue('createItemNotification', current);
	//current.request.requested_for.email
}

The problem is not that it is being sent to the same user, its that the email is not being set at all. The event fires correctly as I can see it in the event logs but the email notification never gets sent. I have other notifications that fire from inserted and updated records and more out of the box notifications that use events which correctly send, but when I try to create a notification with my own event, it does not send.

Things I have tried:

 1. Changing the weight to 0

 2. Making sure recipients have notifications enabled

 3. Checking the send to creator box

 4. Making sure the event and notification run on the same table

Yes, I understand what the problem is, I just wanted to get more information, which you're revealing now.

So taking in to account the 4 things you listed above...we can then try:

1) Is this notification actually "active"?

2) Is there a condition in the notification (so not only the event firing but a condition set) if so...what is that?

3) For Parm1, while you can use email address...I'd recommend just passing the user's sys_id, so current.request.requested_for instead

4) You've said the notification isn't sending, but are you sure? Have you checked sys_email logs to see that it's not going out and perhaps just going to a spam folder or something?

5) Double-check the event you've specified for this notification to ensure it's really set to: 

createItemNotification

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

The problem was number 5.

My event name was catalogItemNotification instead of createItemNotification. I feel like an idiot.

Thank you for the help!

Ouch, yea...glad you got though.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Upender
Giga Expert

Hi,

Please follow below KB which has solutions for most of email notification issues.

 

 

ServiceNow KB: Troubleshooting email notification failures in ServiceNow (KB0538135

 

 

 

Regards,

Upender