LOWER Function in Salesforce | How to convert string to lowercase in Salesforce

In this Salesforce tutorial, we will learn how to use the LOWER function to convert string to lowercase in Salesforce. We will also learn the syntax and real business-related examples where we can use the Salesforce LOWER function.

While working in a company that uses the Salesforce tool, I got a task to make sure that the data entry remained consistent and convert all the strings to lower characters.

To complete my task, I started the research and found that in Salesforce we have one function called “LOWER” that converts the text to the lowercase.

If you want to learn how to use the Salesforce LOWER function with examples in both Salesforce Lightning and Salesforce Classic you have come to the right place. Let’s deep dive into the complete article and learn in detail about Salesforce LOWER.

What is LOWER function in Salesforce

In Salesforce, we have multiple TEXT functions that are used to perform the text operations on the Salesforce fields, and one of them is the Salesforce LOWER() function.

The salesforce LOWER() function, is used to convert the letters specified in the text or string to lowercase. If you pass any other character to the lower function other than string type, those characters remain unaffected i.e. can’t change to lowercase.

In addition, if you pass null to the input string, the lower function returns the result null. The LOWER function concept is available in both the Salesforce Lightning and Salesforce Classic experience.

Furthermore, you can also apply the locale rules if the locale is provided. The LOWER function helps you make the record standardized. It also helps you to make the data integrity and ensure the case sensitivity of the record.

The syntax of the Salesforce LOWER function is as given below:

LOWER(text, [locale])

Here is a detailed description of the parameters:

  • text: The text parameter specifies the string or field that you want to convert to lowercase.
  • locale: The locale parameter is an optional parameter that specifies the two-character ISO language code or five-character local code, if available.

Return: The LOWER function returns the new text or string which has all the characters in the lowercase.

Let’s see an example of the LOWER function to understand the function better:

Suppose a scenario: You are working in an e-commerce company and as a team lead you got a task to add a description of the product and you have to add the description in lowercase characters. So, to complete your task you decided to use the LOWER function that will convert your description to lower character. Let’s see the formula for how you use the LOWER function.

LOWER(Product_Description__c)

With this, we have gained some knowledge of the LOWER function with syntax, real-life examples, and return type.

Now, we will proceed ahead and learn to use the LOWER function to convert the uppercase string to the lowercase string in Salesforce Lightning and Salesforce Classic.

Read SUBSTITUTE Function in Salesforce | Replace Values in Salesforce Formula Field

How to convert string to lowercase in Salesforce Lightning

The following are the steps that are used to convert the string to lowercase using the LOWER function in Salesforce Lightning. Let’s take a scenario and understand it better:

Scenario: Suppose you are working in a company that uses Salesforce as a customer relationship management tool. As a team lead, you have found that in some cases username is written in lowercase, uppercase, and sentence case. And you got a task, to make it in lowercase, so for this, you will decide to use the Salesforce LOWERCASE function.

Let’s see the steps on how to use the LOWER function in Salesforce Lightning to get the solution of the defined scenario.

Step-1: General Steps in Salesforce Lightning to use the LOWER function

  • Login into the Salesforce account in the Lightning interface.
  • If you are not on the setup of the main lightning home page, move your course to the right side of the screen over the “Gear” icon, then click it and select the “Setup” (Setup for the current app) from the dropdown menu.
LOWER Function in Salesforce
  • Find the “Object Manager” option on the navigation bar once you are on the main setup page and click it.
LOWER Function in Salesforce Example
  • The object manager page has now been opened for you, here you can see both customized and pre-built Salesforce objects. Search for the item on which you want to utilize the LOWER function using the “Quick Find” search box. Let’s take an example of the “Contacts” object, so search for it and click on it.
LOWER Function in Salesforce Lightning
  • In this step, on the left side of the page, you will find the “Fields & Relationships” option and select it.
  • Then, creating a custom field where you can use the LOWER function is your main goal, click on the “New” button located at the right top side of the page.
LOWER Function in Salesforce Lightning Example

Step-2: Choose the Field Type in Salesforce Lightning

  • You will see a list of the Salesforce field types that are available in the Salesforce. Choose the appropriate field type from the list based on the scenario defined above. To achieve your above-defined goal, select the “Formula” field type by selecting the radio button next to the formula.
  • Then, click on the “Next” button and move to the next step.
Salesforce LOWER Function

Step-3: Choose the Field Type in Salesforce Lightning

  • After you click on the next button, you will be taken to the “Choose Output Type” page. Here, you should enter the “Field Label” and “Field Name”. I filled out the field label as “Username in Lowercase” in accordance with the scenario. Once you click on the field name box, the field name will be filled in automatically.
  • By scrolling down, select the proper data type for the field that will be used to store the generated output. In accordance with the situation, I need the result in the text format, so to select the text data type, click on the radio button in front of the “TEXT” datatype.
  • To go to the next step, click on the “Next” button.
Salesforce LOWER Function Example

Step-4: Enter Formula in Salesforce Lightning

  • In this step, you are on the add formula page, enter your formula, click on the check syntax to check the errors, and click the advance formula subtab to use additional fields, operators, and functions.
  • Navigate towards the right side of the page in the “Functions” section. In this section, you will see the “All Functions Categories” dropdown, click on it.
  • Once you click you will get the multiple functions categories that are available in Salesforce such as “Date & Time”, “Logical”, “Math”, “Text”, and “Advance”. As you know the LOWER function is part of the text function, so choose the “TEXT” category from the list of function categories.
  • Once you click on it, you will get all the functions related to the text category, and your main agenda is you choose the “LOWER” function, so search and click on it.
  • As soon as you click the function, you will get the option of the “Insert Selected Function” button under the function category box, click on the option, so that the function gets inserted into the advanced formula subtab.
  • Replace the parameters with the appropriate merge field, functions, operators, etc. according to your scenario-specific needs. Below is the formula for the, given requirement of converting string to lowercase.
LOWER(Username__c)

We use the LOWER() function to convert the string inside the function to lowercase. We pass the username__c as a parameter that represents the username of the contact.

  • After entering the formula, click the “Check Syntax” button to validate the entered formula and see if it has any syntax issues.
  • Additionally, you have the option to include “Description” and “Help Text” and how to deal with empty fields.
  • Then, click on the “Next” button to move to the next step.
Salesforce Lightning LOWER Function

Step-5: Establish Field-Level Security in Salesforce Lightning

  • In this step, you are on the page, where you can set up the “Field Level Security”. The field-level security settings allow you to specify which user profiles should have the ability to edit the field. If you don’t add the custom formula field to the field-level security the field will not appear for profiles that have not been selected.
  • Since I want to make the custom formula field available for all profiles, I have checked the box next to the “Visible” option in my case. Then, click on the “Next” button to go to the next step.
Salesforce Lightning LOWER Function Example

Step-6: Add to Page Layout in Salesforce Lightning

  • Here, you need to select the page layout where you want to add the custom formula field. Remember one thing, the field will be added as the last field on the page layout. No page will have the field if you don’t choose a layout. By, default all the available page layouts according to the object are selected, so I keep it as it is and click on the “Save” button to save the newly formed formula field.
How to convert string to lowercase in Salesforce Lightning

Step-7: Testing of the Salesforce Lightning Function

  • Once the formula field is created, you can use the formula field. Let’s see an example:
    • Open the “Contacts” item, create a new contact with the field “Username” and save the contact.
    • Once you save, move to the contact details page. Here you will observe the “Username in Lowercase” field that shows you the outcome of the LOWER function.
  • Let’s deeply understand it with the example:
    • Suppose you have created a contact with the username “JohnDOE123” and save it. The output of the formula is “johndoe123”. This formula effectively changes the string from the uppercase to lowercase.
How to convert string to lowercase in Salesforce Lightning Example

With this, we have learned the use of the LOWER function in Salesforce Lightning. Now, we will move and explore the implementation of the LOWER function in Salesforce Classic, with the help of a scenario.

See also  RPAD Function in Salesforce

Read LEN Function in Salesforce | How to calculate length of a text string in Salesforce

How to convert string to lowercase in Salesforce Classic

The following are the steps that are used to convert the string to lowercase using the LOWER function in Salesforce Classic. Let’s take a scenario and understand it better:

Scenario: Suppose you are working as a support executive in an organization that uses Salesforce. You are managing the team that enters the case priority, and one day you observed that sometimes team members enter the priority level in different styles such as “high”, “MEDIUM”, or “Low”, which causes inconsistency in the analyses. To standardize the case priority, you decide to convert the priority level to lowercase using the LOWER function by creating the formula field.

Let’s see the steps on how to use the LOWER function in Salesforce Classic to get the solution of the defined scenario.

Step-1: General Steps to use the LOWER function in Salesforce Classic

  • Signed to Salesforce Classic Experience. If your account opens in the Lightning Experience, go to “Profile” and select “Switch to Salesforce Classic” from the dropdown menu.
LOWER Function in Salesforce Classic
  • After that, select the “Setup” option, which is situated between the help and username options at the top.
LOWER Function in Salesforce Classic Example
  • In this step, scroll down to the “Build” section, click on the “Customize” dropdown, and choose the Salesforce object where you want to use the LOWER function. I looked for the “Cases” object and clicked on it in accordance with the scenario.
  • On clicking on the cases dropdown, you will get a list of various options. As creating the field where you can use the Salesforce LOWER function is your primary objective, choose the “Fields” option.
Salesforce Classic LOWER Function
  • After you click on the fields option, you are directed to the page where you get the fields, Scroll down to the page and move to the section “Cases Custom Fields & Relationships” and click on the “New” button.
Salesforce Classic LOWER Function Example

Step-2: Choose the Field Type in Salesforce Classic

  • When you click the new button, you will get a list of the field types that are available in Salesforce. Pick the data type from the list that best suits your needs. According to the scenario, your primary task is to use the LOWER function and we can use it in the formula advance subtab. So, to select the “Formula” field type click on the radio button next to the formula.
  • After that, click on the “Next” button and move to the next step.
How to convert string to lowercase in Salesforce

Step-3: Choose Output Type in Salesforce Classic

  • Fill out the “Field Label” and “Field Name” fields in this step. In this case, I have entered “Standardized Priority” and when you hover your mouse over the field name, it immediately fills with data.
  • After this, select the return type of the formula field by scrolling down to the “Formula Return Type” section. As I am converting the string to lowercase, I need the result in the text format. So, I select the radio button next to “Text” to receive the result as text.
  • Click the “Next” button to go to the next step.
Example of Salesforce LOWER function

Step-4: Enter Formula in Salesforce Classic

  • After you click on the next, you are on the enter the formula step. Navigate to the right side of the page to the “Functions” section. Then, click on the “All Functions Categories” dropdown and select “TEXT” as a category as you know the LOWER function is one of the text-type functions.
  • You will get the list of all the functions within the text category, now find the “LOWER” function and click on it.
  • Once you click the function, you get the button “Insert Selected Function” under the functions box, click on it. The function gets inserted into the advance formula box you can replace the function parameter with the appropriate text, fields, etc. as per the requirement.
  • Below is the formula for the, given requirement of converting the string to lowercase.
LOWER(Case_Priority__c)

Here, we use the Salesforce LOWER function to convert the passed field string characters to lowercase. We passed the “Case_Priority__c” as a parameter that contains the string whose value we want to convert to the lowercase and save the result into the newly created formula field called “Standardized_Priority__c”.

  • Click on the “Check Syntax” button situated below the formula box to know whether the formula has any error. If there are no errors, you will get the message “No Syntax errors in merge fields or functions”. If an error is present, an error message will be displayed on the screen.
  • If you want, you can also enter the “Description”, and “Help Text” and also handle the blank fields.
  • Then, click on the “Next” button and move to the next step.
How to convert string to lowercase in Salesforce Example

Step-5: Establish Field-Level Security in Salesforce Classic

  • Here, you need to choose the profiles to whom you want to grant field-level security access to editing fields. If you don’t select any profile, the field will be hidden from these specific profiles. In my case, I have checked the checkbox next to “Visible” as I want to grant an edit facility to all the profiles.
  • After that, click on the “Next” button and move to the next step.
How to convert string to lowercase in Salesforce Classic

Step-6: Add To Page Layout in Salesforce Classic

  • In this step, select the page layouts that will include the newly created custom formula type field. By default, all the page layouts are selected If you don’t want to include the field in the specific page layout, uncheck them and click on the “Save” button.
How to convert string to lowercase in Salesforce Classic Example

Step-7: Testing of the Formula Field in Salesforce Classic

  • Once the formula field is created, you can use the formula field. Let’s see an example:
    • Open the “Case” object, create a new case with the field “Case Priority” and save it.
    • After saving the case, move to the case details page and you will see the “Standardized Priority” field showing the result of the LOWER function.
  • Let’s understand with an example:
    • Suppose, you have created a case with the case priority “HIGH” and saved it. For the standardized priority, the output of the formula is “high”. The formula efficiently converts the string characters to lowercase.
How to use lowercase in Salesforce Classic

With this, we have learned how to use the LOWER function to convert the text to the lowercase in Salesforce Classic with an example.

See also  Salesforce CURRENCYRATE Function

Conclusion

With this, we have learned about the Salesforce LOWER function. In addition, we have also learned the syntax and its practical applications.

Moreover, we have learned the procedure of converting string to lowercase using the LOWER function in Salesforce Lightning as well as in Salesforce Classic.

You may like to read the following articles: