In this Salesforce tutorial, we will learn the procedure of how to break the line in Salesforce using the BR function. In addition to this, we will the syntax of the BR function in Salesforce and also some real-world business-related examples.
While working in an organization that, uses the CRM tool Salesforce for customer management. I got a task where I need to print some basic details of the contract. 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. If you want to learn how to use the BR function in the formula field in Salesforce Lightning and Salesforce Classic, let’s go through this complete article.
What is BR function in Salesforce
In Salesforce BR() function is one of the Salesforce text functions that are used to carry out the 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:" & ContractTerm
With 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.
Read CONTAINS() Function in Salesforce
How to use BR function in Salesforce Lightning
Below are the steps to use the BR function in Salesforce Lightning to break a line:
Step 1: Open your Salesforce account and shift to lightning mode, if presently you are in classic mode. Then, click on the “Gear” icon given on the top right side of the page.
Step 2: Now from the dropdown, select the option “Setup” to move to Salesforce’s main home screen page.

Step 3: From the Salesforce setup page, click on the “Object Manager” option that is shown on the top navigation bar adjacent to the Home Tab.

Step 4: After opening it, it shows multiple Salesforce objects, search for any one of them in which you want to use the BR function using the “Quick Find Search” box.
Step 5: Now, click on the searched object from the list. In this, example I searched for the Salesforce “Campaign” object as I want to get the important upcoming campaign details.

Step 6: Move to the left side of the page and here under the “Detail Section”, you will find an option for “Field & Relationship”. Click on it.
Step 7: After opening the field and relationship page, you will get a button “New” on the top. Click on it, as we are going to create a new field where we will use the BR function.

Step 8: The field type page is opened now and it contains multiple field types. Choose the “Formula” field type field, as I want to use the BR function in the formula.
Step 9: Click on the “Next” button to move to the next step.

Step 10: 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.
Step 11: 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.
Step 12: Click on the “Next” button, to move to the next step.

Step 13: 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.
Step 14: 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.
Step 15: Click on the “Check Syntax” button, to verify that the formula has no errors.
Step 16: Optionally, we can define the “Description” and “Help Text” as well as “Handle the empty field” if we want.
Step 17: Click on the “Next” button to go to the next step.

Step 18: Now, set up the “Field Level Security” and choose the user profiles to whom you want to grant the field-level security edit access to the field. If not added the field level security, the custom formula field that we have created not shows on the unselected profile.
But I want to visible this custom field for all the profiles. So I check the checkbox next to the “Visible” option located at the top.
Step 19: Click on the “Next” button to proceed to the next step.

Step 20: Choose the “Page Layout” where you want to add the custom formula field. If we do not select a layout, the field will not appear on any pages. In this example, I choose all the page layout that shows on the screen.
Step 21: To save the advanced formula field with the BR function, click on the “Save” function.

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 Lightning. Now, we will move and understand the procedure of using the BR function in Salesforce Classic.
Read CASESAFEID() Function in Salesforce
How to use BR function in Salesforce Classic
The following are the steps to use the BR function to break the line in Salesforce Classic.
Step 1: Log in to the Salesforce account first, if you are logged in to the Salesforce Lightning move to the Salesforce classic edition first.
Step 2: For shifting to the classic edition, click on the “Profile Avatar” dropdown, and select the option “Switch to Salesforce Classic” option.

Step 3: Now, click on the “Setup” option from the menu.

Step 4: After opening the setup page, scroll down to the “Build” section, then click on the “Customize” drop-down option and get the list of all the salesforce objects. And from the list of the salesforce object, search for the object for whose field you want to use the BR function.
Step 5: In this example, I choose the “Contact” object, since I need to print the details of the contact with a new line.
Step 6: In the contact dropdown there is a list of multiple options available for the contact object and from these options, I click on the “Fields” option as I want to use the BR function in the custom formula field.

Step 7: The contact custom field page is opened, move to the bottom of the page at the section name “Contact Custom Fields & Relationships”. Click on the “New” button to create a new custom field.

Step 8: The field type page is opened, it contains multiple field types for the custom fields. From this, I choose the “Formula” as the data type as I want to create the formula field with the use of the BR function.
Step 9: Click on the “Next” button to move to the next step.

Step 10: The “Choose Output Type” page is opened. Fill out the “Field Label” and “Field Name” which automatically fill up when you click on the field name field box. In my case, I entered the field label “Contact Personal Details”.
Step 11: Now scroll downwards and move to the section of “Formula Return Type” and the return field type for the field where we want to store the result. In this case, I check the radio button before the “Text” output type to get the formula result in the text format.
Step 12: To move to the next preceding step, click on the “Next” button.

Step 13: The advanced formula editor page is opened, now move to the right side of the page towards Functions. Click on the dropdown and select the Text Functions.
Step 14: It shows the list of the functions that are defined in the text function category. From here, I choose the BR function and enter it in the formula editor box.
Step 15: This time I want to get the detail of the contact but with a line break between each specific detail. So I create the advanced function formula with the necessary field and BR function. The formula is as follows:
"Name:" & FirstName & BR() & "DOB:" & TEXT( Birthdate ) & BR() & "Language Known" & Languages__c
- Here, we are printing the contact details such as FirstName, BirthDate, and Languages__c 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 with the BirthDate field to convert the date type to a text type field. If you do not do so it will produce an error.
Step 16: To check whether the above-written formula is error-free, I clicked on the “Check Syntax” button. If it’s error-free, the success message is printed “No syntax errors in the merge fields or functions”. Otherwise, it will print an error.
Step 17: We also have an optional option to define the “Description” and “Help Text” as well as “Handle the empty field” if we want to.
Step 18: After this, click on the “Next” button to move to the proceeding step.

Step 19: The “Field Level Security” page is opened. Now configure the field-level security by choosing the profiles to whom we want to grant the field-level security editing access. If we have not selected the profile this specific field will be hidden from all the profiles.
As I want to show this field to all the profiles, I check the checkbox next to “Visible”.
Step 20: Click on the “Next” button to move to the next step.

Step 21: The “Add to Page Layout” is opened. Choose the page layout that must have your newly created field. The field would not be shown up on any pages if we do not select a page layout.
Step 22: Click on the “Save” button to save this.

Once we have created the formula field, we can use it. Let’s see an example to check how it works.
- Open the Contact Tab and create a new contact with the field FirstName, Birthdate, and Languages__c.
- The Contact Personal Details field, which displays the BR() function output, appears when we click on the Details Section.

With this, we have learned how to use the Salesforce Classic BR() function.
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.