Text
1. SPECIALSYMBOLS
Allows using of special symbols within the formula.
Use any of the below expressions whenever you need formula to contain special symbol(s):
{QUOTE} for single quote (')
{DBL_QUOTE} for double quote (")
{OPEN_BKT} for opening bracket (()
{CLOSE_BKT} for closing bracket ())
{OPEN_SQR_BKT} for opening square bracket ([)
{CLOSE_SQR_BKT} for closing square bracket (])
{TAB} for tabulation
{BACK_SL} for backslash (\)
{BR} for line break
{RET} for carriage return
IF(STARTS({Request__c.Name}, 'RFQ'), '{OPEN_SQR_BKT}Request for Quote{CLOSE_SQR_BKT}', '{OPEN_SQR_BKT}Service{CLOSE_SQR_BKT}') will return [Request for Quote] if request name starts with 'RFQ', and [Service] if it doesn't.
2. CONTAINS
Compares two arguments of text and returns true if the first argument contains the second argument. If not, returns false.
CONTAINS(source_string, search_string)
Replace source_string with the text that should be searched for a value of search_string.
IF(CONTAINS({Opportunity.Product_Type__c}, 'part'), 'Parts', 'Service') - this formula checks the content of a text field named Product_Type__c and returns 'Parts' for any product with the word 'part' in it. Otherwise, it returns 'Service'.
3. STARTS
Determines whether a string begins with the characters of another string, returning true if it does. If not, returns false.
STARTS(source_string, search_string)
Replace source_string with the text that should be checked for starting from the value of search_string.
IF(STARTS({Request__c.Name}, 'RFQ'), 'Request for Quote', 'Service') - this formula checks the content of a Name field and returns 'Request for Quote' for any request name starting with 'RFQ'. Otherwise, it returns 'Service'.
4. POS
Gets the position of a string within another string and returns it as a number.
POS(source_string, search_string)
Replace source_string with the field or expression you want to search and search_string with the string you want to find.
POS({Contact.Email}, '@') returns the location of the @ sign in a person's email address.
5. ENDS
Determines whether a string ends with the characters of another string, returning true if it does. If not, returns false.
ENDS(source_string, search_string)
Replace source_string with the text that should be checked for ending with the value of search_string.
IF(ENDS({Company__c.Name}, 'TM'), 'Trademark', 'Service mark') this formula checks the content of a Name field and returns 'Trademark' for any item ending with 'TM'. Otherwise, it returns 'Service mark'.
6. SUBSTR
Returns a new String that begins with the character at the specified start position and extends until the character at end position.
SUBSTR(source_string, start_index, end_index)
Replace source_string with the string, field or expression where you want to get a substring from, start_index with the position substring begins from, end_index with the position substring ends at.
Note that position indexes are starting from 0.
SUBSTR({Contact.Name}, 4, 8) in case when Contact.Name value = 'Jefferson' function will return 'erso'.
7. REPLACE
Replaces a sequence of characters in a string with another set of characters, and returns a resulting string.
REPLACE(source_string, from_string, to_string, regex_boolean_optional)
Replace source_string with string to be changed, from_string with characters to be replaced in source_string, and to_string with the replacement set of characters.
User can pass regular expression as a from_string argument as well. In this case user should add 'true' as an optional regex_boolean_optional argument.
REPLACE({Opportunity.Unique_ID__c}, '3a', '2b') - the Unique_ID__c will now contain new value with the '3a' replaced with '2b'.
REPLACE('a3f45qq456', '[^0-9]', '', true) will return 345456.
8. Remove
Removes one or more substrings from a source string.
REMOVE(source_string, string_parameter1, string_parameter2, ...)
Replace source_string with the text field or expression you want to remove substrings from and string_parameter1, string_parameter2, etc with substrings to be removed from the source string.
REMOVE('(555) 555-6789 ', ' ', '(', ')', '-') will return '5555556789'.
9. LEN
Returns the number of characters in a specified text string (string length).
LEN(string)
Replace string with the field or expression which length you want get.
LEN({Product__ั.Code__c}) returns the length of a Product.Code field.
10. SPLIT
Returns an array (a list) that contains each substring of the source string that is split on given parameter. Substrings are placed in the array in the order in which they occur in the source string.
SPLIT(source_string, separator_string)
Replace source_string with the text field or expression to be split, and separator_string with a substring to split on.
SPLIT('AL, AK, AZ, AR', ', ') will return an array of string type elements.
11. JOIN
Joins the elements of an array into a single string separated by the specified separator.
JOIN(array, separator_string, left_string_optional, right_string_optional)
Replace array argument with an array you want to join to a string, separator_string with a string to insert between array elements. left_string_optional and right_string_optional arguments are optional and can be used to modify array elements (add some text leftside or rightside of each of them) before joining.
Let String__c field on Stub__c object stores following string: 'Cars, Plains, Ships'.
{OPEN_SQR_BKT} + JOIN(SPLIT({Stub__c.String__c}, ','), ',', '{DBL_QUOTE}', '{DBL_QUOTE}') + {CLOSE_SQR_BKT} - this formula will split field value to an array and then transform it to a following string: '["Cars", "Plains", "Ships"]'.
12. LOWER
Converts all of the characters in the string to lowercase.
LOWER(string)
Replace string parameter with a string you need to convert to lowercase.
LOWER({Account.Name}) will return Account Name value in lowercase.
13. UPPER
Converts all of the characters in the string to uppercase.
UPPER(string)
Replace string parameter with a string you need to convert to uppercase.
UPPER({Account.Name}) will return Account Name value in uppercase.
14. ESCAPE
Returns a string which characters are escaped using specified rule.
ESCAPE(string, JAVA|JSON|HTML|CSV|XML|UNICODE|QUOTE)
Replace string parameter with a sting to be escaped and sepcify one of the allowed escape rules as second argument.
Let Error__c value is 'Please, fill in "Name"'.
ESCAPE({Stub__c.Error__c}, 'HTML') will return 'Please, fill in "Name"'
ESCAPE({Stub__c.Error__c}, 'JAVA') will return 'Please, fill in \"Name\"'
ESCAPE({Stub__c.Error__c}, 'CSV') will return '"Please, fill in ""Name"""'
ESCAPE({Stub__c.Error__c}, 'XML') will return 'Please, fill in "Name"'
Let String__c value is 'De onde vocรช รฉ?'
ESCAPE({Stub__c.String__c}, 'UNICODE') will return 'De onde voc\u00EA \u00E9?'
15. ID
Converts a string to Salesforce object ID.
ID(string)
Replace string argument with value that should be treated as ID.
ID('a006m00007sMGHjAAO') will return a006m00007sMGHjAAO (some object ID).
16. BR
Adds <br> (line break) HTML tag when used.
Add BR() to other functions or output text values wherever you need a line break.
JOIN(SPLIT({Account.Account_Multy__c}, ';'), BR()) - this formula will first split field value to an array and then transform it to a following text:
'A
B
C'17. TEXT
Converts any data type into text.
TEXT(parameter)
Replace parameter with the field or expression you want to convert to text format.
IF(TEXT({Stub__c.Number__c}) = {Stub__c.Text__c}, true, false) will return true when given Stub.Number numeric value is 25 and Stub.Text string value is '25'.
18. BLOB
Casts the specified string to a Binary Large Object.
BLOB(string)
Replace string argument with a string you need to cast to BLOB
BLOB({Account.LongTextField__c}) will return field value as the BLOB content.
19. TOBASE64
Converts a BLOB to a Base64-encoded String representing its normal form.
TOBASE64(blob_parameter)
Replace blob_parameter with a BLOB content you need to convert to base64.
Let Account.Name value is 'Mary Ann'.
TOBASE64(BLOB({$Account.Name})) will return 'TWFyeSBBbm4='
20. FROMBASE64
Converts a Base64-encoded string to a BLOB representing its normal form.
FROMBASE64(string_parameter)
Replace string_parater with Base64-encoded string.
FROMBASE64('TWFyeSBBbm4=') will return BLOB content of a 'Mary Ann' string.
21. TOHEX
Returns a hexadecimal (base 16) representation of the string.
TOHEX(string_parameter)
Replace string_parameter with a string you need to convert to hex.
Let Account.Name value is 'Mary Ann'.
TOHEX({Account.Name}) will return '4d61727920416e6e'.
22. FROMHEX
Converts the specified hexadecimal (base 16) value to string.
FROMHEX(string_parameter)
Replace string_parameter with a hex string you need to convert to text.
FROMHEX('4d61727920416e6e') will return 'Mary Ann' string.
23. URLENCODE
Encodes or decodes a string in application/x-www-form-urlencoded format using a specific encoding scheme.
URLENCODE(string_to_encode, format_optional, boolean_encode_optional)
Replace string_to_encode parameter with string to be encoded (or decoded).
Optionally: provide specific encoding scheme in format_optional argument (default is UTF-8), and pass false as a boolean_encode_optional argument if you need to decode string.
Let String__c value is 'Test / me'.
URLENCODE({Stub__c.String__c}) will return 'Test+%2F+me'.
Let String__c value is 'Test+%2F+me'.
URLENCODE({Stub__c.String__c}, 'UTF-8', false) will return 'Test / me'.
24. TOTEXTDURATION
ะกonverts integer amount of minutes (numeric value) into string in the XXXh YYm or ZZZd XXh YYm format.
TOTEXTDURATION(integer_minutes_parameter, hours_in_day_optional)
Replace integer_minutes_parameter with integer representing number of minutes to get duration in hours and minutes.
Optional hours_in_day_optional argument represents how many hours in a working day are set. Add it to get duration in working days, hours and minutes.
TOTEXTDURATION(6067) will return '101h 7m'.
TOTEXTDURATION(6067,8) will return '12d 5h 7m', where each day has 8 hours (useful to calculate how many business days will take some process).
TOTEXTDURATION(6067,24) will return '4d 5h 7m' where each day has 24 hours (in this case you will get duration in full days).
25. FROMTEXTDURATION
Converts string in the XXXh YYm or ZZZd XXh YYm format to integer representing number of minutes. Returns numeric value.
FROMTEXTDURATION(string_parameter, hours_in_day_optional)
Replace string_parameter with a string to be converted.
Add optional hours_in_day_optional argument to specify how many work hours one working day consists of.
FROMTEXTDURATION('62h 34m') will return 3754 (62*60 + 34).
FROMTEXTDURATION('3d 2h 34m') will return 4474 (3*24*60 + 2*60 + 34).
FROMTEXTDURATION('3d 2h 34m',8) will return 1594 (3*8*60 + 2*60 + 34).
26. MATCH
Searches a string for a match against a regular expression, and returns the matches in an array.
MATCH(regex_string, data_string)
Replace regex_string with a regular expression, and data_string with the string to compare to regex.
Let Duration__c value is '8d'.
MATCH('[^abc]', {Stub__c.Duration__c}) will return following array: (8, d).
Last updated