Ask Search:
Greg RohmanGreg Rohman 

Add a line break in Flow Designer Assignment element

I have a simple requirement. I have a Visual Flow that is looping on SObject Collection. As I loop, I'm assigning information from each record into a string variable to be used in an email message (text template) at the end of the Flow.

On that Assignment element, I would like to include a line break at the end, so that each iteration through the loop appends the record value plus the line break. I have tried combinations of /r/n, BR(), <br/>, and others, but have not been able to accomplish this.

Thanks.

-Greg

 
Best Answer chosen by Greg Rohman
Gorav SethGorav Seth
i figured a way to add a line break that works in flow emails

create a constant, with the value of globalconstant.emptystring

create a text template and wrap a line break (ie hit enter) between two of these constants

that will insert a line break w/ not additional baggage and will work (as far as i can tell) everywhere, including emails

full blog post here : https://goravseth.com/manipulating-text-in-flows

All Answers

Deepak AnandDeepak Anand
Found it interesting! So here is how I did that:

My Flow:
User-added image

The Tricky Assignment that helped me to Add a New Line:
User-added image

The NewLine was a Text Template(AllAccountNames was simply a Text Variable):
User-added image

The Output:
User-added image
 
Jeff MayJeff May
As usual @Deepak comes to the rescue!
Greg RohmanGreg Rohman
Hi Deepak.

Thanks for the quick response!

The "<br/>" is being appended properly now, but the email being generated from the Send Email flow action appears to be text and not HTML, so the "<br/>" simply appears in the body of the message. I don't see an option in the Send Email action to specify HTML or text format for the message, though. Is that specified elsewhere, or did I miss something else?

-Greg
Deepak AnandDeepak Anand
Oops! That's correct. The Emails fired from the Flow are Plain Text Emails. The only workaround is to set the resulting text generated in the Flow to may be one Rich Text Field on the record in context somewhere else(may be a Custom Object called Email Message) and then fire may be another Workflow Rule + Email Alert[HTML Email / Custom Email].

I know it doesn't sound good but that what I can think of.
Greg RohmanGreg Rohman
Hi Deepak.

It seems like a somewhat convoluted process for a seemingly simple task. For my purposes now, I'll stick to a simple comma-delimited listing in the plain-text email. 

I have also posted an Idea to enable HTML email functionality, in case you wanted to vote:
https://success.salesforce.com/ideaView?id=08730000000DkRoAAK

Thanks again.

-Greg
Alastair DinningAlastair Dinning

I'm trying to use <br/> to insert line breaks into the text that goes to the Salesforce Case Description field, and although <br/> works in the Flow, the line break isn't transposing to the Salesforce field.  Any ideas on how to do this?


Sample of BR from Case record

Greg RohmanGreg Rohman
Hi Alastair.

The standard Description field on the Case object is a long text field, which does not support HTML. If you are simply entering data into the field via the edit page, you can use the ENTER key to add line breaks. There is also the formula function BR() that can be used if populating the Description field via other methods. See if that helps.

-Greg
Alastair DinningAlastair Dinning
Hi Greg, Thanks for the idea. Unfortunately, BR() didn’t work – it was written into the case as text. Entering a text template with just an doesn’t work, because (I think) Salesforce isn’t seeing any characters, so it’s treating it as if nothing was entered. I’ve also tried & BR() & and \n, but neither worked. Alastair
Heidi MischHeidi Misch
Figured I'd post where i found the answer to Alastair's question on inserting a line break into a text area field http://www.jdope.com/blog/newline-carriage-return-in-flow/#comment-1349
Katie ZinmanKatie Zinman
Does anyone know how to store a single Account Name as a text value in Flow? I am only looking for the first Account Name listed in my variable after the Loop.
Nick BudincichNick Budincich
I the NewLine global variable may work, but it isn't clean and nice. It returns dash, linebreak, dash:
"-
-"

In process builder, we just use SUBSTITUTE(!$Label.NewLine, "-","")), but the visual workflow builder says it doesn't recognize the substitute function.

So, my linebreaks as of now have the extra dashes (-). I tried the BR() and <br/> and got that in text form as well.

Would love to make prettier, but there's what I've found!

Nick
Jacob MarshallJacob Marshall
Please upvote the idea to have string literals added to flows: https://success.salesforce.com/ideaView?id=0873A000000lIxrQAE  I've given credit to this post and the Jdope site for a workaround.
Gorav SethGorav Seth
i figured a way to add a line break that works in flow emails

create a constant, with the value of globalconstant.emptystring

create a text template and wrap a line break (ie hit enter) between two of these constants

that will insert a line break w/ not additional baggage and will work (as far as i can tell) everywhere, including emails

full blog post here : https://goravseth.com/manipulating-text-in-flows
This was selected as the best answer
Kiran TelagamsettyKiran Telagamsetty
Wow.. Thank you @deepak, Your solution helped me in my work :) 
Ali AhmedAli Ahmed
The link Heidi shared in not opening,and to answer Alastair question I have found a way:
1) First we have to create a custom label like this
Label
2) Create a formula in the flow and reference the customlabel you created
    should be like this:
User-added image
3) Last thing is adding this formula to your variable in the assignment element:
User-added image

 
Michael HanotMichael Hanot
Hi Greg,
thank you for your question, I encounter the same issue. I managed to handle this thanks to Gorav Seth explanation but I still encounter an issue though. I get the [] in my email.

See my text below. 
Could somebody help me? How can I suppress this? 

Thanks


"Thank you for your registration. Please find below the link(s) which give you access to your requested versions.
[https://euroqol--eq5demail.lightning.force.com/lightning/r/OpportunityLineItem/00k6E0000075Kn4QAE/view,
,https://euroqol--eq5demail.lightning.force.com/lightning/r/OpportunityLineItem/00k6E0000075Kn4QAE/view,
]"
 
Michael HanotMichael Hanot
No need to answer anymore. I understood my issue. I store the data in a collection variable instead of a variable. It is fixed now. 
Thanks