How to use script output in Send Email action in Flow Designer?

Wes8
Tera Contributor

I've been trying to accomplish this for a while now. What I want to do is perform some actions in a script and output a variable with several lines of information. I then want to insert this output variable in the body of an email (Send Email action).

The problem I am seeing is the error message "Email validation failed: Email body is comprised of invalid HTML." when the flow executes.

The script is storing string in a variable with line breaks, when I use "\n" I see no error but the email body does not translate those line breaks and everything runs together. When I use <br> or wrap in <p> I see the validation error.

I've tried different output variable types like string, HTML, HTML Template, Translated HTML, etc.. Nothing seems to work.

Thanks for any help you can offer.

4 REPLIES 4

Andrew Albury-D
Mega Guru

Hi Wes,

Without seeing the flow execution and error when trying to put the string into the email action it's hard to say what is causing it to error for your first case. 

Another option is always Fire an event from Flow Designer (create a record in the Sysevent table), include the extra information you want in the email in the "Parm1 or Parm2" fields, and trigger the notification from the event. 

You may even be able to fire the notification from the script action and skip doing it after that in the flow all together?

Hope that helps,
Andrew

 

Wes8
Tera Contributor

Here is the flow:

find_real_file.png

The goal is that when a user is deactivated, all accounts for that user are deactivated across all instances.

The output of the script in the body of the email should be formatted like this:

find_real_file.png

But the formatting required to get it this way always fails. When I use /n as the line break the validation passes and the email sends but it looks like this:

 

find_real_file.png

.... I've attached the images as well.

Wes8
Tera Contributor

So I was not able to solve the issue of using line breaks in script output within flow designer. However, I was able to accomplish the desired end result by running the actions in an email script and referencing the script in an email notification. This may work in the email action in flow designer, but in the end I just stuck with a simple notification + email script.

Dinethri
Kilo Contributor

hii, wes, can you give your solution here