I love watching the Alteryx Designer discussion boards because I learn new things all the time. This week, a discussion popped up where a user asked how they could incorporate line breaks in an email body. I found a Knowledge Base article that seemed to have the answer, although I wasn’t able to dig into it right away. I posted the link. One of the other ACEs dug into it immediately and posted a solution that I later refined. This is why the Alteryx Community is so awesome. Read on to learn how to incorporate line breaks in an Alteryx email.
Blog or Video
Some people like to read. Others like to watch. You can also find this content on my YouTube channel. Please like and subscribe if you learn something new.
Without “intervention”, the Alteryx email tool will remove line breaks given to it by an input. In the example shown below, I wrote a sales pitch in Word and copied it into a Text Input tool. The line breaks are very clear.
Then, I wrote an expression to combine my sales pitch with the name of the “customer” into a column called Intro. Next, I combined the intro with my sales pitch to create an email body.
I configured the email tool to use my Body column to populate the actual body of the email.
And this is what you get. No line breaks, and it’s ugly. So, how do we fix this?
To fix this, you just need to replace the line breaks with the line break HTML end tag, which is “<br/>”. So, I created a column called Body Reformatted that uses the Replace function. To replace the carriage return, enter a single quote, hit return, and then another single quote to denote the end of what we want to replace. The function replaces the carriage return with the HTML tag, which is interpreted in the Email tool.
replace([Body], ' ', '<br/>')
The email tool uses the Body Reformatted column, rather than the Body column. When sent, the email contains the appropriate line breaks. While the content is garbage, it’s formatted exactly the way I want it to be. Win!
And now you know how to get line breaks in an Alteryx email. If you enjoyed this post, check out my other Alteryx work.