You need to sign in to do that
Don't have an account?
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?
For example (using made-up field names):
Code:
Cheers,
Eric Bezar
salesforce.com Product Management
All Answers
They did, however, promise to submit it as a feature request to the development team.
For example (using made-up field names):
Code:
Cheers,
Eric Bezar
salesforce.com Product Management
Both \n and br() don't seem to work.
Does anyone have any other suggestions?
Thanks,
Phil
Thanks
<div style="page-break-after: always;"> </div>
will do it.
HTH
Jeremy
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;
BR() also works for PDF generation if you're using apex:outputText with escape=false in your PDF:
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:
Did you ever get this to work? I'm having the same issue.
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?
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
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
<
>
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.
<
>
then
MID({!bounded_newline},2,1)
will produce a newline character
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.
'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
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!
"~
~"
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!
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."
'<br>' in rich text field
it's working fine.
'Hi'+'<br><br><br><br>'+'Thank you for contacting us.'
This Youtube video seems to solve the issue using a combination of constants (using {!$GlobalConstant.EmptyString}) and formulas
It worked for me - I wanted to concatenate 2 address lines stored as single text fields and have them as 2 lines in the Street address field (long text format).
https://www.youtube.com/watch?v=afUc85_Af9o