Our Salesforce organization recently implemented a customization for handling customer data. The customer service team needs a standardized format for customer names and emails in their records.
The customer service representatives often enter names and emails in mixed cases, leading to inconsistencies. The team wants to enforce a standardized format to avoid duplicates and errors during data processing.
To solve this, I used Apex methods to convert the Name to title case and the Email to lowercase. In the steps below, I will explain how to convert the string to lowercase and uppercase in Salesforce Apex.
Convert String to Lowercase and Uppercase In Salesforce Apex
To convert a String to lowercase, we use the built-in toLowerCase() method, and to convert a string to uppercase, we use the toUpperCase() method.
Convert String to Lowercase in Salesforce Apex
I will explain the string-to-lowercase conversion in Apex in the steps below. Now, navigate to the Salesforce developer console and follow the steps below.
- To open the anonymous execution window, click on the Debug > Open Execute Debug Window or press the shortcut keys “Ctrl+E.”
- Enter the code below in the anonymous window, select the checkbox, open it in Debug, and click the Execute button.
String name = 'Eva Adams';
System.debug('string in lowercase -' + name.toLowercase());
- In the console log window, select debug only. The values will be converted to lowercase.

This way, we can convert the String to lowercase in Salesforce Apex by following the above steps.
Convert String to Uppercase in Salesforce Apex
To convert a string to Uppercase, we will use the apex function ToUppercase(). Now, navigate to the Salesforce developer console and follow the steps below.
- Open the anonymous window in the Salesforce developer console with the shortcut keys “Ctrl+E.”
- Enter the code below in the anonymous window, select the checkbox, open it in Debug, and click the Execute button.
String name = 'Henry Smith';
System.debug('String in Uppercase -' + name.toUppercase());
- In the Console log window, select debug only. The values will be converted to uppercase.

In this way, we can convert the String to Uppercase in Salesforce Apex by following the above steps.