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

I would agree that a "Notification" is better than an "Email-Always" approach in that it respects the user's preferences.

BUT

The "Notification" method doesn't seem to allow scriptable recipients, only those found in fields in the source record, whereas the Flow Designer's "Send Email" can allow a data-pill or a script to determine the recipients.

So, for example, we may want all incidents of a certain flavor to include a notification to a recipient that is calculated and isn't directly found in fields of the incident.  

Any ideas on how this might be accomplished?

 

Hello Ben

You can write a mail script and in that you can fetch the email address to which you want to sent. Then you can use email.addAddress() and can add the recipients.

Mark the comment as helpful if it helps.

You can use Email Scripts to add recipients to the outgoing email by using the notation that the OP was trying to use in the flow script. 

In the mail script you've got access to the email via the addAddress method.

https://docs.servicenow.com/bundle/paris-servicenow-platform/page/script/server-scripting/reference/r_MailScriptAPI.html

Edit: Or, you know, what asifnoor said.  

 

uwnewbie
Tera Expert

Hi, 

I have a related question. The 'send email' in the flow is nice and easy to use, however when it comes to translations of the email, what would be the best approach?

In the notifications we have implemented, we normally use gs.getMessage().

Now in the flow, should we rather use 'send email' and script ? or trigger a notification? 

I know this works with "trigger a notification" but not sure with "send email". May be you can try with 'send email' first and if it doesn't work, you can use 'trigger a notification' for your solution.

 

Thanks and Regards,

Akshay