While working as system administrator in an organization that uses Salesforce for customer management, I was tasked with printing basic contract details. But there is one twist: each detail must be a new line.
So, I have found that Salesforce provides a function named “BR” that inserts a new line.
In this tutorial, we will learn how to break a line using the BR() function in Salesforce. In addition, we will discuss the syntax of the BR function in Salesforce and provide some real-world business examples.
What is the BR() Function in Salesforce?
In Salesforce, the BR() function is one of the text functions used to perform text operations. This BR() function is to insert an HTML break tag in string formulas.
In addition, to this keep one thing in mind to use the & or + concatenation operators to surround the BR(). And also this function should not be used in mail merge templates, S-controls, and reports.
Below is the syntax of the BR function in Salesforce:
BR()- Here, we don’t pass any value to the parentheses it remain blank.
Let’s look at the scenarios for a better understanding of the BR function.
As I have discussed, I got the task of printing some basic details of the contract. So, here is the function base formula based on the BR function.
"Contract Name:" & Name & BR() "Contract Term:" & ContractTermWith this, we have learned the syntax of the BR() function with real-life based examples. Now, we will proceed and learn how to use the BR function in Salesforce Lightning.
Use the BR() Function in Salesforce
Below are the steps to use the BR function in Salesforce Lightning to break a line:
- Open Salesforce Lightning mode. Next, click the “Gear Icon” in the top right corner of the page. Click “Setup“ from the dropdown menu to continue.

- The setup page opens when you select the Setup option. Here, the “Object Manager” is found in the Navigation Bar next to the Home tab. Click on it.

- The object manager page opens when you click it. There are numerous objects seen here. Use the Quick Find search field to find the item on which we want to use the BR() function.
- Now, click the “Campaign” object to move to the lead object page.

- On the product object page, the “Field & Relationship” option is in the details section on the left. Select “Field & Relationship” from the menu.
- The field and relationships page is opened after selecting the field and relationship option. Click the “New” button at the top of the page.

- The field type page opens when you click the new button. The page contains a wide variety of field types. In this case, I chose the “Formula” field type, as I want to use the TEXT function in the advanced formula.
- Click the “Next” button to move on to the next step.

- Now, the choose output type page opens. Here, we enter the information by filling in the “Field Label” and the “Field Name” which automatically fills up as you enter the field label.
- In this example, I entered the field label as “Campaign Details”, as I want to get the important upcoming campaign details.
- Now scroll down, move to the output data type, and choose the “Output Data Type” for the field in which you want to store the resultant output. Here, I check the radio button next to the “Text” data type as I want to get the result in text format.
- Click on the “Next” button, to move to the next step.

- Move to the advanced formula editor box, move to the right side in the Functions Section, and from the dropdown choose the Text Categories Functions.
- Select the BR function from the list of text functions and enter it into the formula editor. In this example, I use the BR function to print the details of the upcoming campaign with the line break. The formula is as below:
"Campaign:" & Name & BR() & "Satrt Date:" & TEXT(StartDate) & BR() & "End Date:" & TEXT(EndDate)- Here, we are printing the campaign details such as Name, StartDate, and EndDate with a line break in each detail.
- So, to break the line and insert the new line, we use the BR() function of Salesforce.
- We have also used the & operator to concatenate the two text values together.
- In addition, we use the TEXT() function to convert the date type to a text type field. If you do not do so it will produce an error.
- Click on the “Check Syntax” button, to verify that the formula has no errors.
- Optionally, we can define the “Description” and “Help Text” as well as “Handle the empty field” if we want.
- Click on the “Next” button to go to the next step.

- In this step, establish “Field-Level Security“. Choose the profiles to which we wish to grant field-level security edit access to this field. If field-level security is not added, the field will be hidden from all profiles.
- As I want it to be visible to all profiles, I have checked the “Visible” checkbox. After that, click the “Next” button located at the top.

- Add the custom field to the “Page Layout“ after setting up the field-level security. Pick the page layout that has this field in it. If we do not select a layout, the field will not appear on any pages.
- To save the formula field, click the “Save” button.

We can use the formula field once we have created it. Let’s look at an example:
- Open the Campaign Tab and create a new campaign with the field Name, StartDate, and EndDate.
- Move to the Detail Section, where the Campaign Details field displays the output of the BR() function.

As a result, we have learned how to use the BR function in Salesforce.
Conclusion
In conclusion, we have learned about the Salesforce BR() function. In addition, we have learned the syntax of the Salesforce BR function with multiple real-world business scenarios.
Furthermore, we have learned the procedure of the BR function in Salesforce Lightning and Salesforce Classic.
You may like to read:
I am Bijay Kumar, the founder of SalesforceFAQs.com. Having over 10 years of experience working in salesforce technologies for clients across the world (Canada, Australia, United States, United Kingdom, New Zealand, etc.). I am a certified salesforce administrator and expert with experience in developing salesforce applications and projects. My goal is to make it easy for people to learn and use salesforce technologies by providing simple and easy-to-understand solutions. Check out the complete profile on About us.