Loading
About Salesforce Data 360
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          String Functions for Formulas

          String Functions for Formulas

          Use a string function to manipulate the text data type, including email, phone, time, and date values. For example, change text from uppercase to lowercase, concatenate values from multiple fields, and replace values.

          When you enter a formula, use the API name of the field in the expression, not the label. Enclose text in single straight quotes ('This is a string.') and parameters in parentheses.

          Formula expressions support these string functions.

          String Function Description Syntax
          char_length Returns the number of characters in the specified string. Length includes leading and trailing spaces.

          char_length(field)

          field is the text field to measure.

          Example

          char_length(product_name)
          concat Returns a string by merging the values of the specified fields and input strings.

          concat(field1,field2,...fieldN)

          field1 is the first text field to include in the concatenated value.

          field2 is the second text field to include.

          fieldN is any number of additional text fields to include.

          Example

          concat("OwnerId.FirstName",' ',"OwnerId.LastName")
          endsWith Returns True if the specified string is found at the end of the field value. You can use this function only in case functions.

          ends_with(fieldName,literal)

          fieldName is the text field to search.

          literal is the value to search for at the end of the field.

          instr Returns the first location of the text in the specified field. You can specify a different position to start the search or find the location of a different search string.

          instr(field, searchString, [position, [occurrence]])

          field is the text field evaluated to find the searchString.

          searchString is the text field searched for in the field.

          position is the location in field where to start the search. If you don't specify a position, the search begins at position 1.

          occurrence is the searchString instance to return. If you don’t specify a position with the occurrence, the search begins at position 1.

          Example: Evaluate text for an exclamation point

          instr('123!456!78!', !)
          --The result is 4
          
          
          instr('123!456!8!', !, [4])
          --The result is 7
          
          
          instr('123!456!8!', !, [4, [2]])
          --The result is 9
          lower Returns the string with all characters in lowercase. If the input string is null, the result is null.

          lower(field)

          field is the text field to convert to lowercase.

          Example

          lower("Account.Industry")
          ltrim Removes the specified characters from the beginning of a string in a field. If you don’t specify characters, it removes the string’s leading spaces.

          ltrim(field,[valueToBeRemoved])

          field is the text field to remove the leading spaces or specified characters from.

          valueToBeRemoved is the value to remove from the string. If unspecified, the transformation removes the leading spaces.

          Example: Trim the leading space characters from a string

          ltrim('     5 Spaces Before')
          md5 Returns a 32-character string that is a text representation of the hexadecimal value of a 128-bit checksum.

          md5(field)

          field (Required) is the text for which you want to calculate the checksum.

          Example

          md5("Account_Name")
          replace Replaces a string with another string. If any argument is null, the function returns null. This function is case-sensitive.

          replace(field,searchString,replacementString)

          string is the text field that contains the string to replace.

          searchString is the string to replace.

          replacementString is the value to replace the string.

          Example

          replace(Account_Name,'salesforce.com','Salesforce') 
          rtrim Removes the specified characters from the end of a string in a field. If you don’t specify characters, it removes the string’s trailing spaces.

          rtrim(field, [valueToBeRemoved])

          field is the text field to remove the trailing spaces or specified substring from.

          valueToBeRemoved is the value to remove from the string. If unspecified, the transformation removes the trailing spaces.

          Example: Trim the two trailing space characters from a string

          rtrim('2 Spaces After  ')
          sha2 Converts a variable-length string of characters into a fixed-length string of characters. The character string is a text representation of the hexadecimal value of the checksum with the specified number of bits. SHA-224, SHA-256, SHA-384, and SHA-512 are supported. Bit length of 0 is equivalent to 256.

          sha2(field, bitLength

          field (Required) is the text to convert into a into a character string.

          bitLength (Required) is an integer that defines the number of bits in the hash function. Valid values are 0, 224, 256, 384, and 512.

          Example

          sha2('account_name', 224);
          startsWith Returns True if the specified string is found at the beginning of the field value. You can use this function only in case functions.

          startsWith(fieldName,literal)

          fieldName is the text field to search.

          literal is the value to search for at the beginning of the field.

          string Converts the date or number value to a string data type.

          string(expression)

          expression is the date or number field to convert.

          substr Returns the specified number of characters from the string, starting at the specified position. Also called substring.

          substr(field,position,len)

          field is the text field to extract the substring from.

          position is the starting character position of the substring. The first character in a string is position 1. If the position is negative, the position is relative to the end of the string. A position of -1 is the last character.

          len is the number of characters to return. If the length is 0, the output is an empty string. If the length is negative, the function returns null. This parameter is optional.

          Example

          substr(Account_Id,13,3)
          title Returns the string with the first character of every word in uppercase and the other characters in lowercase.

          title(field)

          field is the text field to apply title case to.

          Example

          title(Opp_Name)
          trim Removes the specified characters from the beginning and end of a field value. If no string is specified, it removes the spaces from the beginning and end of a string.

          trim(field, [valueToBeRemoved)]

          field is the text field to remove the specified substring from.

          valueToBeRemoved is the value removed from the string. This parameter is optional. If unspecified, the transformation removes the trailing spaces.

          Example

          trim('  Spaces Before and After  ')
          upper Returns the string with all characters in uppercase. If the string is null, the result is null.

          upper(field)

          field is the text field to convert to uppercase.

          Example

          upper(First_Name)
          • Notation for String Formulas
            If you manually type your formulas, use single quotes for string literals and double quotes for joined fields with dot notation or reserved keywords.
          • Reserved Keywords in Formulas
            Batch data transforms have reserved keywords that need special handling when manually writing formulas. Use double quotes “ when referencing fields that share a name with reserved keywords. To avoid cross-referencing your field names with this list, the best practice is to use double quotes around all field names.
           
          Loading
          Salesforce Help | Article