How to call email script from the flow designer

Akshay14
Tera Guru

Hi All,

We have requirement to send emails to all the group manager as the part of daily scheduled job. We are exploring how to achieve this using flow designer. 

Question - Can anyone let us know how to call email script from flow designer.

The below format that we use in notifications table(sysevent_email_action) is not working in flow designer.

${mail_script:scriptName}

Please find below screen shot for your reference. 

find_real_file.png

 

Please note that we have implemented these kind of requirements in past by creating a scheduled job and triggering email notification from scheduled job, but now we want to try this using flow designer.

Thanks in advance. 

 

Thanks and Regards,

Akshay

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Akshay,

There is Send Email Action in flow designer but that mentions the subject, body, recipient etc

https://docs.servicenow.com/bundle/newyork-servicenow-platform/page/administer/flow-designer/referen...

Not sure whether existing email can be triggered. Check below link:

https://community.servicenow.com/community?id=community_article&sys_id=3450a52fdbcf2740afc902d5ca961...

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

20 REPLIES 20

Hi, 

I have used event to trigger the notification for the solution. I've referred steps given in below link. 

https://community.servicenow.com/community?id=community_article&sys_id=3450a52fdbcf2740afc902d5ca961...

 

Short answer - You can use "Create Record" OOB Action on the Events table (sysevent) to generate a new Event in Flow Designer. 

Make sure you have event created in event registry table and corresponding notification to send email when event is fired. 

Thanks and Regards
Akshay

I need a notification to caller where INC is in awaiting user info for 24 hours (testing with 3 min). I have created the notification but can't call it from this flow designer. And while I did try the send email feature, I couldn't figure out how to include a link to the body of the INC. Either ${number} just printed in the body or using the pill picker just printed the sys_id and didn't include a link.

alexcorvino
ServiceNow Employee
ServiceNow Employee

The trigger notification step isn't directly available from the flow canvas because the step requires a record pill which needs a specific table to be defined prior to design. Instead, what you need to do is author an action that calls the trigger notification step. For example, if I wanted to author an action that fired a specific notification for an incident record I would select New->Action from flow designer's main drop down

 

find_real_file.png

 

Name it and give it a description

find_real_file.png

Add the notification step to the action by pressing the "+" between inputs and outputs

find_real_file.png

 

Add the incident record as an input:

find_real_file.png

 

And finally, configure the step.

 

find_real_file.png

 

Save and publish it to have the action available from the flow canvas.

 

find_real_file.png 

Your explanation and response is so appreciated! I was able to achieve this. 

Dub Myers
ServiceNow Employee
ServiceNow Employee

A couple of points to make on this.

Regarding the note to use 'Send Notification'.  It is important to understand the distinction between these two.

Many people use "Email" and "Notification" interchangeably, which can lead to some misunderstanding about what functionality exists.

Currently, 'Send Email' is quite unrelated to the notification system and its features.

Notifications are a higher-level construct, allowing you to define a message via different channels (e.g., sms, email, push, slack, teams...) if they are defined using features like mail script, as well as templates and layouts.  The notification system then generates the correct channel's message depending on how you defined the notification itself. This system also handles checking and respecting each recipient's notification preferences as to which channel they would like to receive the message on.

But when you use 'Send Email' you are not using the notification system. You are bypassing the notifcation system and directly creating an email in the email table according to your business needs. A natural consequence then is that a recipient cannot control whether they want to receive your 'Send Email'-originated email via their Notification Preferences. You also don't have access to features implemented in the notification system itself.

If you intend to use 'Send Email', then I would suggest that rather than adding the complication of mail script into the 'Send Email' feature, the more natural way in the flow designer mindset might be to create your message body output in a prior step (i.e. "Generate My Special Message"), then use that computed output as input for your message in the 'Send Email' step.

And if you do have enhancement ideas in this area, you can also add those in the community "Idea Portal"