Javascript required
Skip to content Skip to sidebar Skip to footer

Feedback Form Carriage Return Line Feeds Stripped

Welcome to Support!

Search for an answer or ask a question of the zone or Customer Support.

Need help? Dismiss

James McGill James McGill

Add a carriage return/line break to a custom formula

I have a text formula to which I would like to add a carriage return/line break.  I tried concatenating chr(13) and chr(10), but the validation didn't like it.  Is this possible?

  • October 5, 2006
  • ·
  • Like
  • 0
  • ·
  • Follow
  • 11

Best Answer chosen by Admin(Salesforce Developers)

EricB EricB

There is a new formula function called BR() in the Winter '07 release.  This will allow you to insert an HTML line break tag into text formula expressions.

For example (using made-up field names):
Code:

Address1 & BR() &                              
Address2 & BR() &
City & ", " & State & " " & PostalCode & BR() &
Country

 Cheers,
Eric Bezar
salesforce.com Product Management

  • October 17, 2006
  • ·
  • Like
  • 5
  • ·
  • Dislike
  • 2

All Answers

KML KML

I asked Salesforce Support the same question in June as was told "this feature is not available".

They did, however, promise to submit it as a feature request to the development team.

  • October 12, 2006
  • ·
  • Like
  • 0
  • ·
  • Dislike
  • 0

EricB EricB

There is a new formula function called BR() in the Winter '07 release.  This will allow you to insert an HTML line break tag into text formula expressions.

For example (using made-up field names):
Code:

Address1 & BR() &                            
Address2 & BR() &
City & ", " & State & " " & PostalCode & BR() &
Country

 Cheers,
Eric Bezar
salesforce.com Product Management

This was selected as the best answer

James McGill James McGill

Looks good!  I assume that this will work with text formulas for a Mail Merge?

What I am trying to do is have users check boxes that indicate the capabilities we offer, based on the boxes checked, a capability description is created.  I would like a carriage return between each so that when they are shown in the Word document they are each on their own line.  Will the BR() let me do this?

Also, when will the 07 be released?

  • October 17, 2006
  • ·
  • Like
  • 0
  • ·
  • Dislike
  • 0

Phil_R Phil_R

The BR() tag works on formulae in salesforce, however when inserting a multi-row formula to a visualforce page (rendering as pdf) returns a result on one line rather than keeping the line breaks.

Both \n and br() don't seem to work.
Does anyone have any other suggestions?
Thanks,
Phil

  • August 5, 2008
  • ·
  • Like
  • 0
  • ·
  • Dislike
  • 0

beener beener

And while were at it, does anyone know how to create a page break (new page) when a Visualforce page is rendered as PDF?

Thanks

  • November 23, 2008
  • ·
  • Like
  • 0
  • ·
  • Dislike
  • 0

JeremyKraybill JeremyKraybill

Just in case you didn't find this anywhere else, I was looking for the same thing and found it in a post here.

<div style="page-break-after: always;">&nbsp;</div>

will do it.

HTH

Jeremy

  • December 3, 2008
  • ·
  • Like
  • 0
  • ·
  • Dislike
  • 0

boihue boihue

I think that the "\n" will work for the Carriage Return case:

sReason = 'Retired';

newRec.Description__C = '*** Reason for Archiving ***';

newRec.Description__c += '\n\n' + sReason;

  • February 25, 2009
  • ·
  • Like
  • 0
  • ·
  • Dislike
  • 0

eto eto


Phil_R wrote:
The BR() tag works on formulae in salesforce, however when inserting a multi-row formula to a visualforce page (rendering as pdf) returns a result on one line rather than keeping the line breaks.

Both \n and br() don't seem to work.
Does anyone have any other suggestions?



BR() also works for PDF generation if you're using apex:outputText with escape=false in your PDF:

<apex:outputText escape="false" value="{!yourfield}>

Message Edited by eto on 06-12-2009 05:39 AM

  • June 12, 2009
  • ·
  • Like
  • 0
  • ·
  • Dislike
  • 0

fifedog15 fifedog15

I know this is an old thread but I'm unable to get this to work in a field update workflow rule.

There is what I have in my workflow rule update:

"1.0 This Order .... by both parties." & BR() &  "2.0 Standard.... the Special Terms section."  However this is what the output is on screen: 1.0 This Order .... by both parties. 2.0 Standard .... the Special Terms section.

  • February 22, 2011
  • ·
  • Like
  • 0
  • ·
  • Dislike
  • 0

Rifleman Rifleman

Did you ever get this to work?  I'm having the same issue.

  • March 1, 2012
  • ·
  • Like
  • 0
  • ·
  • Dislike
  • 0

KevinBr KevinBr

Visual Workflows (not apex/visual page) seem to be different as well..

I'm trying to assign a variable to Case Description and a constant variable CR set to \r\n

ie

{!varCaseDescription} equals  Steps{!CR}Line2{!CR}Line2{!CR}Line3

The \r\n gets to the description field as literals and not converted to their cr/lf codes.

I noticed that html tags also get stripped out. (ie, <p> or <br>)

Is there a way to do this?

  • April 11, 2012
  • ·
  • Like
  • 0
  • ·
  • Dislike
  • 0

Bing Bing

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

Bayern

Germany

Bing Maletz

  • January 28, 2013
  • ·
  • Like
  • 1
  • ·
  • Dislike
  • 0

Bing Bing

I just noticed that function BR() only works with data type "Text Area" and "Text Area (Long)".  It doesn't work with "Text Area (Rich)".

Bing Maletz

  • February 11, 2013
  • ·
  • Like
  • 0
  • ·
  • Dislike
  • 0

docbill docbill

BR() litterally only works when you want HTML formatting.  If for example your formula field is being returned by an api call, this is probably not what you want...   One way that does allow you to insert a new line or any other special characters is to use labels.   For example, I have a label called NewLine.   The text of the label is litterally:

<
>

From within a formula field I can reference this like:

TRIM(Address_Line1__c+MID($Label.NewLine,1,1)
+Address_Line2__c+MID($Label.NewLine,1,1)
+Address_Line3__c+MID($Label.NewLine,1,1)
+Address_Line4__c)

Note, the label needs to have the dummy starting end ending characters, because all leading and trailing whitespace will be removed.

  • January 13, 2015
  • ·
  • Like
  • 1
  • ·
  • Dislike
  • 0

Steve Cox 9 Steve Cox 9

For info, using the bounding < and > characters also works when constructing text withing visual flow formulae. However, rather than using a label, you need to create the item by using the 'Text Templates' resource and referring to it in the formula contruction. If the text teplate is called bounded_newline and consists of:

<
>

then

MID({!bounded_newline},2,1)

will produce a newline character

  • February 19, 2016
  • ·
  • Like
  • 0
  • ·
  • Dislike
  • 0

Brian Oconnell 23 Brian Oconnell 23

In a visual flow formula field which populates a custom field of type Long Text Area(32768), I cannot add a line break.
I've tried BR(), \n\r, <br/>, Text Templates, etc.

So frustrating that this should be the most difficult part of a very complex Flow.

  • April 5, 2016
  • ·
  • Like
  • 2
  • ·
  • Dislike
  • 0

Patrick Maxwell 2 Patrick Maxwell 2

@brian, try this hack out, it worked for me https://automationchampion.com/2015/08/06/getting-started-with-process-builder-part-40-adding-a-line-break-in-process-builder-formula/#comment-3963

  • June 1, 2016
  • ·
  • Like
  • 3
  • ·
  • Dislike
  • 0

Kendra Von Achen Kendra Von Achen

Thanks Patrick Maxwell 2, that was a great trick! It's not working as expected in my current Process Builder, but i think it got me a step closer!

  • September 23, 2016
  • ·
  • Like
  • 0
  • ·
  • Dislike
  • 0

Moggy Moggy

I just tried all the most common mentioned in the post, I got my text field as it should be with
'sometext ' & a variable & '<br/>' & sometext

sometext abc
sometext

BR() didn't worked so as '\n' the <br/> worked if you put it in single quotas

  • September 27, 2016
  • ·
  • Like
  • 1
  • ·
  • Dislike
  • 1

John Ondusko 2 John Ondusko 2

I am uploading using a field from MS-SQL and used chr(10) (outside of quotes) - seems to work a treat.

  • November 30, 2016
  • ·
  • Like
  • 0
  • ·
  • Dislike
  • 0

Mee Sharma Mee Sharma

I know i am picking a very old thread. But guys plz help me put on this.i am facing a similiar issue

I have a flow that populates the content of a ContentNote record. i use a formula that combines values from various variables in the flow and concatenate it.This concatenated text is displayed in the body of the contentNote record.
I am facing issues in adding linebreaks between the two concatenated formulas.I have tried everything BR(),
, /n,/r,
,Substitute((text),"~","").Nothing seems to work.Plz help!

User-added image User-added image

  • August 18, 2017
  • ·
  • Like
  • 0
  • ·
  • Dislike
  • 0

Patrick Maxwell 2 Patrick Maxwell 2

Hi @Meenakshi, I know how annoying this is, so I'll attempt to answer this for you, but recommend that you review the link I provided above for help.  I don't know what value is in the variable {!NewLinetext} in your screenshot above, but it were this value, it should work (quotes not required.)

"~

~"

I don't know if this "trick" will work if that variable is a flow variable.  The way I do this is using a custom label (Setup->Create->Custom Label) and passing that variable/reference in my SUBSTITUTE formula.

Good Luck!

  • August 23, 2017
  • ·
  • Like
  • 1
  • ·
  • Dislike
  • 0

Rich Finn 2 Rich Finn 2

Here is how you can incorporate a carriage return in a message that you want to send in an email within a Process Flow.

1.    Create a custom label (Setup/Create/Custom Labels) – I called mine MedPro_Line_Feed.  The value is a carriage return surrounded by pipes (i.e., "|").  See Figure 1.

2.    Then you want to create a formula field in your Flow where you concatenate the MedPro_Line_Feed in your message – please note that the pipes "|" are substituted out of the message so you are left with just the carriage return.

3.    Add the formula field as the body of the email to be sent.  I used simple email where you identify subject, body, Email addresses.

Figure 1: Create new Custom Label
 Custom Label Detail
             Short Description    MedPro Line FeedName
                         Language   English

                         Value |
                                   |

Figure 2: Create a formula field as text with the following:
"Please review the Contact information listed below to see if a duplicate record exists." & SUBSTITUTE($Label.MedPro_Line_Feed, "|", "") & SUBSTITUTE($Label.MedPro_Line_Feed, "|", "") & "Contact Name / ID : " &  {!v_Name_Formula} &" / " & {!v_CONTACTID_Found} &SUBSTITUTE(
$Label.MedPro_Line_Feed , "|", "") & SUBSTITUTE( $Label.MedPro_Line_Feed , "|", "")
&"                     Email : " & {!v_Contact_Email}  & SUBSTITUTE( $Label.MedPro_Line_Feed , "|", "")&SUBSTITUTE( $Label.MedPro_Line_Feed , "|", "") & " Thank you."

  • March 14, 2019
  • ·
  • Like
  • 1
  • ·
  • Dislike
  • 0

Rabbani Basha 1 Rabbani Basha 1

try this below
it's working fine.

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

  • August 7, 2019
  • ·
  • Like
  • 0
  • ·
  • Dislike
  • 0

Kristi Ward Kristi Ward

None of the BR(),'BR()', '<br>', '<br />' work in the Process Builder, using a long text field.  After 13 years, why hasn't Salesforce fixed this?

  • February 4, 2020
  • ·
  • Like
  • 0
  • ·
  • Dislike
  • 0

You need to sign in to do that.

Dismiss

  • Need help?

kirtleywhiname.blogspot.com

Source: https://developer.salesforce.com/forums/?id=906F00000008v7VIAQ