There is a formula function called BR() that allows us to insert a line break into text formula expressions or string of text, As shown in the following screenshot:
The expected result in the formula field is:
LastName
FirstName
But you will get the actual result similar to the following line because of the known issue (https://success.salesforce.com/issues_view?id=a1p300000008YkZAAU)
LastName_BR_ENCODED_FirstName_BR_ENCODED_
Let’s start with a business use case
Business Use Case
Pamela Kline is working as a System administrator at Universal Containers (UC). She wants to update the Lead’s Description field with Lead Name, Lead’s Last Name in the next line of Lead’s First Name.
Solution for the above business requirement
One workaround I have found is to use Custom label and SUBSTITUTE function in process builder formula. Follow the below instructions to create a Process Builder and Custom Label to solve the above business requirement.
1. Click on Setup | Build | Create | Custom Labels
2. Click on New Custom Labels, it will open the new window for you. Now create a new custom label, as shown in the following screenshot:
3. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder
4. To create a new process from scratch, click on the New Button available on Process Management page. A popup will appear, where you have to enter the Name (Use Line break in Process Builder formula as a name), API Name and Description as shown in the below screenshot:
5. Click on Object node to add object and then select the Lead object. For the entry criteria, Select when a record is created or edited, as shown in the below screenshot:
4. The next task is to add Process Criteria, To do this click on Add Criteria, enter Name, Type of action and set filter conditions (In this case select No Criteria – Just execute the actions!) and click on the Save button, as shown in the following screenshot:
5. The next step is to add an Immediate action to Process. Click on Add Action (Under Immediate actions), Select the type of action to create (In our case Record Updates), and then fill the values into fields to define the action, as shown in the following screenshot:
Where $Label.NewLine represents the custom label.
6. Once you are done, click on the Save button, it will redirect you to Process Canvas. Finally, the Process will look like the following screenshot
Don’t forget to active the Process by clicking on the Activate button.
58 thoughts on “Getting Started with Process Builder – Part 40 (Adding a line break in Process Builder formula)”
Comment navigation
Klaus
Super workaround, works with flows as well! Thanks a lot!
Rakesh Gupta
Thanks, Klaus! I am glad it was helpful 🙂
Travis
I know this is likely a silly question, but how would this work if I’m using to create a task and I want the description to have the carriage return?
I’m not quite understanding how the formula would work since I’m not relying on fields, instead plain text. My initial thought would be something along the lines of:
STRING(TEXT(“Text”)) &
SUBSTITUTE($LABEL.NewLine, “-“, “”) &
STRING(TEXT(“More Text”))
But that doesn’t seem to work.
Also tried:
TEXT(“Text”) &
SUBSTITUTE($LABEL.NewLine, “-“, “”) &
TEXT(“More Text”)
and:
“Text” &
SUBSTITUTE($LABEL.NewLine, “-“, “”) &
“More Text”
I’m sure it’s something simple (I hope).
Michele Kleinhomer
Travis…I was able to use the workaround to add line breaks when creating a task via Process Builder. Here is the formula that I used when setting the content of the Description field.
Michele
“Update the following project fields on the portal’s project page for project ” +
[Project2__c].Name + “: ” +
substitute($Label.NewLine,”-“,””) +
if(ISCHANGED([Project2__c].Project_Title__c ) ,”Title”,””) + substitute($Label.NewLine,”-“,””) +
if(ISCHANGED([Project2__c].Abstract__c ) ,”Abstract”,””) + substitute($Label.NewLine,”-“,””) +
if(ISCHANGED([Project2__c].Impacts__c ) ,”Impacts”,””)
Comment navigation