UPPER Function in Salesforce | How to convert String to Uppercase in Salesforce

In this Salesforce Tutorial, we will learn how to convert string to upper case using the Salesforce UPPER Function. In addition, we will also learn the syntax and real business-related applications where we can use the Salesforce UPPER Function.

While working in a company that uses the Salesforce tool, one day I got a task to convert all the client’s names to capital letters to prevent duplicate entries and making data consistency.

To get the solution to the assigned task, I started the research and found that in Salesforce we have one function called “UPPER” that converts the text to the upper case.

If you want to learn how to use the Salesforce UPPER 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 UPPER.

What is the UPPER Function in Salesforce

The UPPER() Function in Salesforce is one of the TEXT functions of Salesforce, which is used to perform the text operations on the Salesforce fields.

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

Moreover, you can also apply the locale rules if the locale is provided. The UPPER 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 UPPER function is as given below:

UPPER(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 uppercase.
  • locale: The locale parameter is an optional parameter that specifies the two-character ISO language code or five-character local code, if available.

The UPPER function returns the new text or string that has all the letters in uppercase.

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

Suppose a scenario where you are working in an e-commerce company as a team lead and you get a task to enter the records of the client, but your manager tells you to make sure that you don’t enter the record of one client twice and you have to check uniqueness of the client on the bases of the email address of the client.

So, to complete your task you found that you need a Salesforce UPPER function that you will use on your email address field. Let’s see the formula for how you use the UPPER function:

UPPER(Email)

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

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

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

Convert String to Upper Case in Salesforce Lightning

Below are the steps that are used to convert the string to uppercase using a UPPER function in Salesforce Lightning:

Step-1: Log in and Search for an Object in Salesforce Lightning Experience

  • Sign in to your Salesforce account in the Lightning experience interface.
  • If you are not on the main lightning home page setup, navigate towards the right side on the “Gear” icon, click on it, and then from the dropdown menu, choose the “Setup” (Setup for the current app) option.
UPPER Function in Salesforce
  • Once you reach the main setup page, locate the “Object Manager” option on the navigation bar and click on it.
UPPER Function in Salesforce Example
  • You are now directed to the object manager page, here you will see both custom and standard Salesforce objects. Use the “Quick Find Search” box and search for the object on which you want to use the UPPER function. Let’s take an example, You want to use the UPPER function in the “Accounts” so you search for it and click on it.
UPPER Function in Salesforce Lightning

Step-2: Salesforce Fields & Relationship

  • Once you click on the accounts object, you will move to the accounts object manager page. Here, you will get the “Fields & Relationships” option on the left side of the page, click on it.
  • After that, click on the “New” button situated at the right top side of the page, and click on it as your main objective is to create a custom field where you can use the UPPER function.
UPPER Function in Salesforce Lightning Example

Step-3: Choose the Field Type

  • In this step, you will get the list of all the field types that are available in Salesforce. Choose the field type that you need according to your requirements as per your example.
  • As your main objective is to use the UPPER function, you need to the formula field for it. So, click on the radio button in front of the “Formula” field type.
  • Then, click on the “Next” button to move to the next step.
Salesforce UPPER Function

Step-4: Choose Output Type

  • In this step, you need to enter the “Field Label” and “Field Name” and after that, you need to choose the formula return type as per your requirement. Let’s take an example: Here, I entered the field label “Address Standardization” and then moved downwards and chose the formula return type as “TEXT” to ensure that the formula return value is formatted as text.
  • Then, to proceed, click on the “Next” button.
Salesforce UPPER Function Example

Step-5: Enter the Formula and Check Syntax

  • You are on the “Add Formula” step. Move the cursor to the right side of the page, where the “Functions Section” is located. From the “All Functions Categories” dropdown choose the function category according to the requirement.
  • Our requirement is to use the UPPER function and you know that it is one of the TEXT-type functions, so click on the “TEXT” category. After that search and select the UPPER function from the list and then click on the “Insert Selected Function” button located below the function box.
  • Once the function is added to the advance formula tab, replace the parameters with the merge fields, string, etc. according to the requirement.
  • Let’s take an example to understand the UPPER function better: Suppose you want to convert all entered accounts’ addresses to uppercase to make the uniformity in the address added. So, below is the formula for the scenario:
UPPER(ShippingStreet) & ", " & UPPER(ShippingCity) & ", " & UPPER(ShippingState)
  • Here is a detailed explanation of the formula:
    • We use the UPPER() function to convert the string inside the function to uppercase.
    • We pass the ShippingStreet as a parameter that represents the street address of the account.
    • We have also passed the ShippingCity as a parameter that represents the city of the account.
    • In addition, we passed the ShippingState as a parameter that represents the state of the account.
    • We also used the comma enclosed in the quotation mark, which acts as a separator between street, city, and state.
    • The concatenation operator “&” is also used to connect the comma with the shipping street, city, and state.
  • After entering the formula, it’s time to check whether the formula entered is error-free or not. To validate the formula click on the “Check Syntax” button, and if the formula is error-free you will get the message “No Syntax Error”, if not you will get an error message.
  • Additionally, you have the option to add “Description”, and “Help Text” and determine how to handle empty fields. Then, click on the “Next” button to move to the next step.
Salesforce Lightning UPPER Function

Step-6: Establish Field-Level Security

  • In this step, establish the field-level security. Choose the user profile to whom you want to grant edit access to the field. If you don’t select the profile, the custom formula field that you have created will not appear for profiles that have not been selected for edit access. In the example: I selected the checkbox next to the “Visible” option, as I want to make this custom formula field visible for all profiles.
  • After that, click on the “Next” button and move to the next step.
Salesforce Lightning UPPER Function Example

Step-7: Add to Page Layout

  • Choose the specific “Page Layout” in which you want to add the custom formula field. On the page, the field will be added in the last. If you don’t select the page, the field will not appear on this specific page. By default, all the page layouts are selected, so I directly click on the “Save” button because I want to keep the settings as it is.
Convert String to Upper Case in Salesforce Lightning

Step-8: Testing and Example

  • Once the formula field is created, you can use the formula field. Let’s see an example:
    • Open the “Accounts” item, create a new account with the “Street”, “City”, and “State” fields, and save the account.
    • On successful saving of the account, move to the account details page. You will see the “Address Standardization” field here that shows you the result of the UPPER function of Salesforce.
  • Let’s understand with an example:
    • Imagine you have created an account, with the street, city, and state “1234 Main St”, “Los Angeles”, and “State of California” and save it. The output of the formula is “1234 MAIN ST, LOS ANGELES, STATE OF CALIFORNIA”. This formula effectively changes the letters of strings from lowercase to uppercase.
Convert String to Upper Case in Salesforce Lightning Example

With this, we have learned the utilization of the UPPER function in Salesforce Lightning, we shall now move and explore the implementation of the UPPER function in Salesforce Classic, with the help of an example.

See also  ISCHANGED Function in Salesforce

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

Convert String to Upper Case in Salesforce Classic

The following are the steps that are used to convert string to uppercase in Salesforce Classic using the UPPER function.

Step-1: Login and Search for an Object in Salesforce Classic Experience

  • Sign in to your salesforce account in the Classic experience interface. If your account opens in the Lightning Experience, navigate to the “Profile” and then from the dropdown, click on the “Switch to Salesforce Classic” option.
UPPER Function in Salesforce Classic
  • Once you successfully log in to the Salesforce Classic, click on the “Setup” option at the top right side between the username and the help option.
UPPER Function in Salesforce Classic Example

Step-2: Choose Object and Create Field

  • In this step, scroll down towards the “Build” section on the right side, click on the “Customize” dropdown, and from the list of objects choose the object either standard or custom in which you want to use the UPPER function. In this example, I searched for the “Orders” object and clicked on it.
  • From the object dropdown, you will get the list of various options for the object of the order, click on the “Fields” option as your main objective is to create a field.
Salesforce Classic UPPER Function
  • After you click on the fields option, you are directed to the page where you get the fields, Scroll down to the page move to the section “Orders Custom Fields & Relationships” and click on the “New” button.
Salesforce Classic UPPER Function Example

Step-3: Choose the Field Type

  • In this step, you have to specify the type of information that the custom field will contain according to your requirement. Your main need is to create the field where you can use the function and it is only possible in the formula field, so click on the radio button adjacent to the “Formula” and select it.
  • Then click on the “Next” button, to proceed to the next step.
Convert String to Upper Case in Salesforce Classic

Step-4: Choose Output Type

  • In this step, enter the “Field Label” and “Field Name” fields. In this example, I have entered the field label “Order Serial Number” and when you put your cursor on the field name, it automatically populates.
  • Move down to the “Formula Return Type” section and choose the return type for the formula field. As my requirement is to print the order serial number, I need the result in the text format. To get the result as text, I click on the radio button in front of the “Text”.
  • Now, click on the “Next” button and move to the next step.
Convert String to Upper Case in Salesforce Classic Example

Step-5: Enter the Formula

  • Once you click on the next button, move to the “Functions” section on the right side.
  • Here you have a dropdown “All Function Categories”, click on it. Now you get various categories of functions, and you know that the function you need resides in the “Text” category, so click on it.
  • You will now get all the functions that are of text type, search for your function and click on it. In my case, I searched for the “UPPER” function and clicked on it.
  • The function is selected, now insert it into the advance formula subtab by clicking on the “Insert Selected Function” button located under the functions section.
  • Once the function is added to the subtab, replace the function parameters with the relevant text, field, etc. as per the need.
  • Let’s take an example to understand the UPPER function better: Suppose you want to add a serial number to the order, and you want it must be in the CAPTIAL letters. So, below is the formula for the scenario:
"ORDER-" & UPPER(Order_Number__c)
  • Here is a detailed explanation of the formula:
    • The UPPER function is used to convert the string passed as the parameter to the uppercase.
    • The Order_Number__c is the parameter that we passed to the UPPER function that specifies the order number of the order.
    • The & is the concatenation operator that is used to connect the text with the order number.
    • The ORDER- is the text that you add to the order number.
  • Once you enter the formula, you have to check whether it is working correctly or has some error, for this, you need to click on the “Check Syntax” button. If your formula has some error, it gives you an error message, otherwise, you will get the success message “No syntax errors in merge fields or functions”.
  • Optionally, you can enter the “Description” and “Help Text” fields. Even if you want you can specify how to manage a blank field if you want. After that, click on the “Next” button and move to the next step.
How to Convert String to Upper Case in Salesforce Classic

Step-6: Establish Field Level Security

  • Now, choose the profiles to which you want to grant edit access to the field-level security. The field will be hidden from all profiles if you do not add it to the field-level security. In my example, I want to give access to all the profiles, so to check all of them, I simply click on the “Visible” checkbox.
  • Then, click on the “Next” button to move to the next step.
How to Convert String to Upper Case in Salesforce Classic Example

Step-7: Add To Page Layout

  • In this step, select the page layout that should include this field. The field will be added as the last field in the column of these selected page layouts. If you do not select a layout, the field will not appear on any page.
  • By default all the page layouts are selected, if you want to unselect any one of them, you can do it. After that, click on the “Save” button and complete the process.
How to use UPPER Function in Salesforce Classic

Step-8: Testing

  • Once the formula field is created, you can use the formula field. Let’s see an example:
    • Open the “Order” item, create a new order with the “Order Number” fields, and save the order.
    • On successful saving of the order, move to the order details page. You will see the “Order Serial Number” field that shows you the result of the UPPER function.
  • Let’s understand with an example:
    • Imagine you have created an order, with the order number “125fu56DF5” and saved it. So for the order serial number, the output of the formula is “ORDER-125FU56DF5”. The formula effectively changes the lowercase letter to uppercase.
How to use UPPER Function in Salesforce Classic Example

With this, we have learned how to use the UPPER function to convert the lowercase string or text to the uppercase string or text in Salesforce Classic.

See also  Salesforce PRIORVALUE Function

Conclusion

In conclusion, we have learned how the Salesforce UPPER function helps to convert the lowercase letter to the uppercase letter. We have also learned the syntax and some practical examples.

In addition, we observed how to use the UPPER function both within the Salesforce Lightning interface and in the traditional Salesforce Classic environment for converting the string to uppercase.

You may like to read the following article: