The CreatorCon Call for Content is officially open! Get started here.

Event/Workflow activity isn't triggering Email Notification

Taylor Stubbs
Giga Expert

We're trying to send email notifications using an event, but when testing it out we can't get email notification to trigger. Event triggers, but email isn't being delievered to 'requested for'.

Workflow Activity Script - 
gs.eventQueue('sc_req_item.notify_ade_voice_rejection', '', '');

Under the Who Will Receive tab - 
Users/Group in Fields is set to 'Requested For'

AND

We've tested it with Event Parm 1 and 2, only parm 1, only parm 2 and without either but same result. 


1 ACCEPTED SOLUTION

This is where we landed, updated workflow activity with the following script and check boxed the parameter 2. 
gs.eventQueue('event_name',current,current.number,gs.getUserName());
But still running into issues with some of the email notification not triggering after event has been successfully triggered. Each email notificaiton has its own event and workflow activity.
I've reached out to our ServiceNow resources within our company but they aren't able to locate the problem area. 3/5 aren't generating email notifications, 

View solution in original post

9 REPLIES 9

Tushar
Kilo Sage
Kilo Sage

Hi @Taylor Stubbs 

 

Please make sure that the email address of the "requested for" user is entered correctly in the workflow activity script and check that the workflow activity script is being executed when the event is triggered.

You can check this by setting a breakpoint in the workflow activity script and then triggering the event.

 

Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!

Regards,
Tushar

'Requested For' is a field within the REQ/RITM so we're not hard coding any email address in the workflow activity. 

 

maroon_byte
Mega Sage

You are missing the record: gs.eventQueue('sc_req_item.notify_ade_voice_rejection', current, '', '');

The eventQueue() method inserts an event in an event queue. The eventQueue() method is typically passed four parameters but can also take an optional 5th parameter:

  1. Event name. Enclose the event name in quotes.
  2. GlideRecord object, typically current but can be any GlideRecord object from the event's table.
  3. Any value that resolves to a string. This is known as parm1 (Parameter 1). Can be a string, variable that resolves to a string, or method that resolves to a string.
  4. Any value that resolves to a string. This is known as parm2 (Parameter 2). Can be a string, variable that resolves to a string, or method that resolves to a string.
  5. (Optional) Name of the queue to manage the event.

This is where we landed, updated workflow activity with the following script and check boxed the parameter 2. 
gs.eventQueue('event_name',current,current.number,gs.getUserName());
But still running into issues with some of the email notification not triggering after event has been successfully triggered. Each email notificaiton has its own event and workflow activity.
I've reached out to our ServiceNow resources within our company but they aren't able to locate the problem area. 3/5 aren't generating email notifications,