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
IZavalunIZavalun 

New Line in the Message Body field

Please help me to figure out what is the syntax to make the new line in the messageBody field of the "Send an Email" form ==> \n\r doestn't work
=================================================
 
var messageBody = " Dear {!IS_TSR__c.TSR_Recipient_1__c}, On {!IS_TSR__c.Service_Date__c} our Technical Representative, {!IS_TSR__c.CreatedBy}, performed services on the following band saw machine"
michaelforcemichaelforce
shot in the dark here... but does html work? i.e. <br>
IZavalunIZavalun

I tried the <br> also, it didn’t work

 

Rasmus MenckeRasmus Mencke

if you are creating a text email, it will normally only take character returns as line breaks.

If it is HTML content you should be able to use html tags like <br> and <p>

 

You could try to use either chr(10) or chr(13)

sfdcfoxsfdcfox
Actually, you can also use the following code:

{!BR()}

The "{! ... }" syntax that you see in email templates isn't a dummy function that puts whatever field you name in there. Instead, it actually runs any arbitrary formula code that makes sense! So you can use the code above and Salesforce will actually generate an appropriate newline at that point in the template. Although, I haven't tested it so I'm not sure what code actually gets generated, but it should translate to a newline in both text and HTML templates.

~ sfdcfox ~
IZavalunIZavalun

It's great idea, I was so glad to test it, but unfortunatelly it didn't work :(

Thanks for an idea

sfdcfoxsfdcfox
Oh. Right. Since SOAP uses XML, whitespace is effectively ignored. Try using:

&#a; or &#d; instead... See if that works, let us know. :smileyvery-happy:

~ sfdcfox ~
IZavalunIZavalun

I tryied both options and again they didn't work. I will be glad to hear more of your ideas.

===============================================

 

var messageBody = "Dear {!IS_TSR__c.TSR_Recipient_1__c},  &#d; On {!IS_TSR__c.Service_Date__c} our Technical Representative, {!IS_TSR__c.CreatedBy}, performed services on the following band saw machine:  {!IS_TSR__c.Machine_Make__c}.";

michaelforcemichaelforce
how about a little unicode: %0d
IZavalunIZavalun
Didn't work
 
==================================================
var messageBody = "Dear {!IS_TSR__c.TSR_Recipient_1__c},  %0d  On {!IS_TSR__c.Service_Date__c} our Technical Representative, {!IS_TSR__c.CreatedBy}, performed services on the following band saw machine:  {!IS_TSR__c.Machine_Make__c}.";