0

I have a text template within a flow like this -

There has been an error with automation

Id - {!$Record.New_Id__c}

Error Message - {!ErrorText}

I'm using this text template as the body of an sendEmail action. I can't work out how to add newlines to the email body - it gets sent as one long string of text.

I've tried wrapping the text in <p></p> tags, using <br/>, using \r \n with both the 'view in plain text' and 'view in rich text' settings, but it didn't work.

0

Is this the sendEmail action from the sample flow pack?

It may be an issue with how the flow is interpreting the characters you're entering, you can try replacing all the '\r' or '\n' characters for the HtmlBody with '<br />' after you have already set up the email body as a string, like so:

HtmlBody.replace('\r\n','<br \>');

When working with the HtmlBody in Apex <br> works fine, so I think it's the front end of the flow not using the right characters. An example:

mail.setSubject('Example Email');
mail.setHtmlBody('Hi ' + Contact.FirstName + ',<br>' +'<br>' + 'Message continues 
here...');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.