function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Adding line break in a text function to be used in text email

Trying to standardize our greeting in all of our Email Templates used in responses, and we want to simply have a custom function that when added to an email template will look like:



Thank you for contacting us.

 The challenge with using the BR() tag is that it actually inserts as:


Hi,<br>Thank you for contacting us.<br>

 Which obviously won't render properly in a text email.


I've tried adding in \r\n, \n, just adding a carriage return in my formula, but can't seem to get any of that to work. Also tried the following, but no luck.

("Hi," & '\n' & "Thank you for contacting us." & '\n')


Any thoughts?








You don't need to include BR() or \n in your text,since you are using simple Text template.

just type your text as you want, means -  Hi, and then type in new line and save .

It will send mail with text exactly same as you typed.





Thank you for contacting us.

Indeed, that's easy enough if I simply want to hard-code in my template, however I'm trying to put this in a formula that could be used in every template in order to standardize my greeting across all templates and enable easier changes to the greeting.


For example, if I want this greeting across 200 text templates, and I anticipate changing it (perhaps to add a marketing message) quarterly, it would be easiest to create a formula that could be embedded in every template to allow me to make 1 change quarterly rather than 200.


Hi friend,


Am bit confuse, are you talking about formula field or a function like BR(). If it is formula field than it's simple and otherwise

defining a function like BR() is not possible in salesforce that can be used in template.


I'm talking about a formula field that I would then use in an email template.


For example, I can define a case custom field as a formula as "Thank you for contacting us." and simply insert {!Case.Greeting} in every email template. The challenge is in adding carriage returns in the body of the formula.


Just heard back from support and was told this was custom development, so it may not be possible.


I assume you've figured this out by now, but here's what I just did.


I have a field on opportunity that takes a related contact's phone, email, mobile and combines it with a formula (including the BR() function) into 1 field.  I did this so I could have easy access to the contact's data from the Opportutnity, but when I use the field in a TEXT format email template, I get the <BR> HTML tag as text (ugly and useless in this format).


Instead, I made 3 additional formula fields that pull each of the email, phone, and mobile as fields on the Opportunity record.  They are NOT presented on the GUI.  I use these fields on the TEXT format email template instead of the GUI formatted combined field.





There is an existing function BR(), which is to add line break in text formula


For example:

Contact__r.FirstName & " " & Contact__r.LastName & BR() 
&Contact__r.MailingStreet &BR() 
&Contact__r.MailingPostalCode& " "& Contact__r.MailingCity & BR() 
& Contact__r.MailingState & BR() 
& Contact__r.MailingCountry


This returns

John Doe

Hauptstrasse 1234

88888 Munich




Bing Maletz


HI Bing,

              i am get proper result but i want to populate the return value into a pdf ....i am not getting the line break in pdf.




Did you find a solution for this? Can you please share your solution.

Rabbani Basha 1Rabbani Basha 1
try this below
it's working fine.

'Hi'+'<br><br><br><br>'+'Thank you for contacting us.'