UPPER and LOWER Functions in Salesforce

In this Salesforce tutorial, we will learn about UPPER and LOWER Functions in Salesforce. In that, we will discuss the following topics:

  • UPPER Function in Salesforce.
  • How to Convert String to Upper Case in Salesforce.
  • LOWER Function in Salesforce.
  • How to Convert String to Lower Case in Salesforce.

UPPER Function in Salesforce

The UPPER() Function in Salesforce is a TEXT Field function that performs text operations on Salesforce fields.

The Salesforce UPPER() Function converts all letters in the specified text string to uppercase. In addition, if you pass any character other than string type, the function leaves those characters unaffected.

Syntax Upper() Function

Below is the syntax of the Salesforce Upper function:

UPPER(text, [locale])
  • Text: The text parameter specifies the string or field you want to convert to uppercase.
  • Locale: The locale parameter is optional. If available, it specifies the two-character ISO language code or five-character local code.

The UPPER Function returns the new text or string with all the characters in Uppercase.

Convert String to Upper Case in Salesforce

Below are the steps to convert the string to uppercase using a UPPER() function in Salesforce.

1. Log in to Salesforce Org. -> Go to Setup. -> Object Manager tab. -> Search for the Object you want to perform the Upper function. Here, I have selected the Account object.

UPPER Function in Salesforce

2. Click on Fields & Relationships. -> Then click the New button.

UPPER Function in Salesforce Lightning Example

3. Select the Data Type as the Formula because we will use the Upper Function. Then click on the Next button.

Salesforce UPPER Function

4. As we know, we can perform the Upper function on the Text field, so for that, here we need to select Formula, a Return type as Text.

Then, Enter the Field Label, and the Field Name will automatically populate. After that, click on the Next button.

Salesforce UPPER Function Example

5. Here, we will create a Formula to display ShippingStreet, ShippingCity, and ShippingState in a single text field. This field will be a formula, and the values of these fields should be displayed in Upper Case only.

  • Now click on the Formula Editor. Then, choose the function category from the “All Functions Categories” dropdown according to your requirements. Here, we are going to use the UPPER Function. Click on it.
UPPER(ShippingStreet) & ", " & UPPER(ShippingCity) & ", " & UPPER(ShippingState)
  • Here is a detailed explanation of the formula:
    • UPPER(): To convert the string inside the function to uppercase.
    • Insert Field: Add Account fields using the Insert Field button.
    • The concatenation operator “&” connects the string with the shipping street, city, and state.
  • To validate the formula, click on the “Check Syntax” button. Then, click the “Next” button to move to the next step.
Salesforce Lightning UPPER Function

6. Establish Field-Level Security. To select which profiles this field should be visible to, select the checkbox next to the “Visible” profile. After that, click on the “Next” button and proceed to the next step.

Salesforce Lightning UPPER Function Example

7. Add to Page Layout: Select the page layout on which you want to display this formula field. Then click on the “Save” button.

Convert String to Upper Case in Salesforce Lightning

8. Proof of Concept: Once the formula field is created, navigate to the Object on which you created it. Here, I’m going to create an Account record with the “Street,” “City,” and “State” fields and Save the account.

You will see the Address Standardization(Formula Field) field here, which shows the result of the UPPER function with the Concatenated Text values of the “Street,” “City,” and Statefields.

UPPER and LOWER Functions in Salesforce

This is how we have seen how to use the Upper Function with the formula field in Salesforce.

Read SUBSTITUTE Function in Salesforce

LOWER Function in Salesforce

In Salesforce, we have multiple TEXT functions that perform text operations on the Salesforce fields, one of which is the Salesforce LOWER() function.

The Salesforce LOWER() function converts the letters specified in the text or string to lowercase. If you pass any character to the lower function other than string type, those characters remain the same, i.e., they can’t change to lowercase.

Syntax LOWER() Function

Below is the syntax of the Salesforce Lower function:

LOWER(text, [locale])

Here is a detailed description of the parameters:

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

The LOWER function returns the new Text or string with all the characters in the lowercase.

Convert String to Lower Case in Salesforce

The following steps convert the string to lowercase using the LOWER function in Salesforce.

1. Log in to Salesforce Org. -> Go to Setup. -> Object Manager tab. -> Search for the Object you want to perform the Lower function. Here, I have selected the Contact object.

2. Click on Fields & Relationships. -> Then click the New button. -> Formula data type. -> Select Return type as Text.

  • Then, Enter the Field Label and the Field Name. After that, click on the Next button.

3. Here, we will create a Formula to display the string in lowercase.

Now click on the Formula Editor. Then, choose the function category from the “All Functions Categories” dropdown according to your requirements. Here, we are going to use the LOWER Function. Click on it.

LOWER(Username__c)

Here is a detailed explanation of the formula:

LOWER(): To convert the string inside the function to lowercase.

Insert Field: Add fields using the Insert Field button.

To validate the formula, click on the “Check Syntax” button. Then, click the “Next” button to move to the next step.

Salesforce Lightning LOWER Function

4. Establish Field-Level Security. To select which profiles this field should be visible to, select the checkbox next to the “Visible” profile. Then, click on the “Next” button to proceed to the next step.

Salesforce Lightning LOWER Function Example

5. Add to Page Layout: Select the page layout on which you want to display this formula field. Then click on the “Save” button.

How to convert string to lowercase in Salesforce Lightning

6. Proof of Concept: Once the formula field is created, Open the “Contacts” object, create a new contact with the field “Username,” and Save the contact.

Once you save the record, you will see that in the formula field we created recently, if you enter the Username in uppercase, it will be converted to lowercase.

  • Let’s deeply understand it with the example:
    • Suppose you have created a contact with the username “JohnDOE123” and saved it. The output of the formula is “johndoe123.” This formula effectively changes the string from uppercase to lowercase.
How to convert string to lowercase in Salesforce Lightning Example

This is how we have seen how to use the Lower Function with the formula field in Salesforce.

Read LEN Function in Salesforce

Conclusion

In this article, we have discussed the Upper and Lower functions in Salesforce. I have explained how to convert the lowercase string into uppercase using the UPPER() and the uppercase string into lowercase using the LOWER() functions with an example and step-by-step explanation.

You may like to read the following article:

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.

Salesforce flows complete guide

FREE SALESFORCE FLOW EBOOK

Learn how to work with flows in Salesforce with 5 different real time examples.