Manipulating text in flows

i occasionally need to iterate over a list of records in a sObject collection, and display values from the records in a screen.

back in the day i got some crucial help from salesforce yoda / mark ross on this developerforce post, which pointed at the approach.

use a text variable to store the final concatenated text for display.
call it : vaFinalText

use a loop to iterate over your collection. in the loop, use an assignment element with a text template that references the loop variable to add data to the final text variable
call it : ttLoopText

and use a constant, with a value of < br /> to add line breaks between each loop (which i cribbed, probably from this post)

this approach of using the <br /> in a constant works fine in many cases, but not in email, as flow emails are strictly plain text, so the <br /> comes through exactly as entered.

test_BR.png

i had seen some solutions for this that involved a text template and a substitute function, which i was hoping to avoid. so after about 13 failed attempts, i found a winning recipe:

create a constant, w/ a value of globalconstant.emptystring
call it : conGCES

conGCES.png

in a text template, add the constant, a line break (ie click enter), and the constant again. call the text template ttLineBreak

ttLineBreak.png

use that text template to insert line breaks. you also could just wrap your loop variable text with conGCES in ttLoopText

lvwconGCES.png

and voila, a flow email, with line breaks.

voila.png

flow doesnt come easy…makes you work for it…

 
122
Kudos
 
122
Kudos

Now read this

ISCHANGED and PRIORVALUE in Before Save Flows (not for after save flows)

UPDATE - DEC 2020 : Spring21 should offer this natively, per poking in my pre-release org. Will link to release notes when they are available. Before save flows do not directly offer functions like ISCHANGED, ISNEW, and PRIORVALUE ISNEW... Continue →