How to call email script and how to access variable value in flow designer

SSA1
Giga Expert

I'm facing a issue when I'm writing a flow.

There I need to call a email script in that email script,

URL

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {

          var url = '<a href="' + gs.getProperty('glide.servlet.uri') + 'sp">click here</a>';


   template.print(url);
	

})(current, template, email, email_action, event);

I need to print this url in flow designer 'Send Email' action.

But when I use that, output shows as below.

Please ${mail_script:URL for service portal} to approve the request.

How can I avoid this and use mail script proper way

1 ACCEPTED SOLUTION

Maik Skoddow
Tera Patron
Tera Patron

Hi @SSA 

you cannot execute Email Scripts at Flow Designer. And to my mind direct creating of emails at Flow Designer is not a good idea because each time something should be modified (recipients, content, layout etc.) you have to modify the Flow and republish it.

Therefore and with respect to your requirement I recommend creating an event from Flow Designer. You can pass the URL as parm1 or parm2 parameter to your platform Email Notification

How to trigger en event from Flow Designer is described at the following article: https://community.servicenow.com/community?id=community_article&sys_id=3450a52fdbcf2740afc902d5ca961...

 

Kind regards
Maik

If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.

View solution in original post

4 REPLIES 4

Maik Skoddow
Tera Patron
Tera Patron

Hi @SSA 

you cannot execute Email Scripts at Flow Designer. And to my mind direct creating of emails at Flow Designer is not a good idea because each time something should be modified (recipients, content, layout etc.) you have to modify the Flow and republish it.

Therefore and with respect to your requirement I recommend creating an event from Flow Designer. You can pass the URL as parm1 or parm2 parameter to your platform Email Notification

How to trigger en event from Flow Designer is described at the following article: https://community.servicenow.com/community?id=community_article&sys_id=3450a52fdbcf2740afc902d5ca961...

 

Kind regards
Maik

If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.

Hi @SSA 

Did my reply answer your question?

If so, please mark the appropriate response as "correct" so that the question will appear as resolved for other users who may have a similar question in the future.

If not, please tell me what you are still missing!

Many thanks & kind regards
Maik

Community Alums
Not applicable

Hi,

You can refer to this thread:

https://community.servicenow.com/community?id=community_question&sys_id=ae2b0be6db020cd85129a851ca961950

 

Please mark my answer as Correct & Helpful, if applicable.

Thanks

Sandeep

Uncle Rob
Kilo Patron

Hope nobody minds the thread zombie, but I found this thread reaches to the top of nearly all my flow design searches on community.   For this problem in particular I browsed through all the myriad threads discussing the issue, made a video of the solution, and posted it here....