REVERSE() Function in Salesforce [Syntax & Real Examples]
The REVERSE() function in Salesforce allows reversing the order of characters in a text string, which helps solve limitations like extracting characters from the right side of a string. By combining REVERSE() with functions like LEFT() and RIGHT(), admins can create formulas to manipulate and extract parts of text fields that are otherwise hard to parse. For example, extracting the last three digits of an order number by reversing and then slicing the string. The article walks through steps to implement such formulas in Salesforce, using practical examples like campaign names and explains how to create those fields via the Setup UI.
- Use REVERSE() to reverse the order of characters in a text string.
- Combine REVERSE() with LEFT() and RIGHT() functions to extract parts of strings.
- Create formula fields in Salesforce Setup to apply text manipulations without Apex.
- Check formula syntax to ensure no errors before saving.
- Use REVERSE() for complex string extraction tasks that standard functions cannot handle.
In a company, order numbers are stored in a format like ORD-458921 . The manager wants to create a short tracking code using only the last three digits of the order number. However, Salesforce formulas cannot directly read text from right to left. To solve this, you can use the REVERSE() function. First, reverse the order number so the last digits come to the front, then use the LEFT() function to pick the first three characters, and finally reverse it again to get the correct digits. This way, from ORD-458921 , you can easily extract 921 using a formula, which would otherwise be difficult to achieve. In this article, we will learn about how to use the REVERSE() function in Salesforce with practical examples. What is the REVERSE() Function in Salesforce? The Salesforce REVERSE() function is one of several TEXT functions available in Salesforce that perform text operations on fields.