Send email from Business rule script

tessob
Kilo Explorer

Hi,

I'm trying to find solution how to send e-mail from Business rule script. I have find GlideEmailOutbound() class, but I can only define its fields with setters. What to do next?

4 REPLIES 4

Chuck Tomasi
Tera Patron

Hi Denis,



Emails can be sent from business rules using an event. You can create an event (or use an existing one) in the Event Registry. Triggering the event in the BR is done using gs.eventQueue(). The notification is set up to react to the event being triggered.



Email Notifications - ServiceNow Wiki


Events and Email Notification - ServiceNow Wiki


chirag_bagdai
ServiceNow Employee
ServiceNow Employee

Hi Denis,



Here are some steps & screenshots which can be helpful for you :



1. Create Event Registry


2. Create Email Notification or update email notification with "When to Send" -> set event


3. Add gs.eventQueue in business rule



Screen Shot 2017-06-27 at 6.01.14 PM.png


Screen Shot 2017-06-27 at 6.02.27 PM.png


Screen Shot 2017-06-27 at 6.03.27 PM.png


Is there any way to pass parameters from the business rule via the trigger into the email? I'd like to publish them into the email body

 

Thank you

Hi Greg,

 

Yes parameters can be passed in event. Below is the syntax:

 

gs.eventQueue('eventName',current,Parm1,Parm2);

 

Kindly mark this Helpful if it helps!