Supported operators and functions

The operators and functions detailed here are used for conditions and formulas.

Supported operators

Operators must be used inline, for example:

  • A and B or C

  • A && B || C

  • A && B or C

  • D <> E

  • D != E

Operator Description
Logical

and

AND 

&&

Use to link two or more operands that must all evaluate to the defined value for the condition to be met.

Not case sensitive.

or

OR

||

Use to link two or more operands, any of which must evaluate to the defined value for the condition to be met.

Not case sensitive.

=

Equal to.

<>

!=

Not equal to.

>

Greater than.

<

Less than.

>=

Greater than or equal to.

<=

Less than or equal to.

Numerical
+

Plus.

-

Minus.

*

Multiply.

/

Divide.

^

Power.

Supported functions

Function Description and syntax
Date and Time
DATE

Returns a day of the month as a number from 1 to 31 for a given date with year, month, and day values. Salesforce displays an error on the detail page if the value of the DATE function in a formula field is an invalid date. For example, February 29 in a non-leapyear.

DATE(year,month,day)

Where:

  • year is a four-digit year

  • month is a two-digit month

  • day is a two-digit day

TODAY

Returns the current day as a date data type.

TODAY()

Informational
BLANKVALUE

Determines if an expression is blank and returns a substitute expression if it is. If the expression has a value, returns the value of the expression.

BLANKVALUE(expression, substitute_expression_if_blank)

Where:

  • expression is the expression you want to evaluate

  • substitute_expression_if_blank is the value you want to replace any blank values

CONTAINS

Determines if the expression contains a value you specify.

CONTAINS(expression, contains_value)

Where:

  • expression is the expression you want to evaluate.

  • contains_value is the text value in quotes or the name of a field.

EVAL

Evaluates a string and if the string represents an expression, returns the value of the expression.

EVAL(string)

Where:

  • string is the character string you want to evaluate

ISBLANK

Determines if an expression is null and returns TRUE if it is. If the expression contains a value, ISBLANK returns FALSE.

ISBLANK(expression)

Where:

  • expression is the expression you want to evaluate.

NULLVALUE

Determines if an expression is null (blank) and returns a substitute expression if it is. If the expression isn't blank, returns the value of the expression.

NULLVALUE doesn't support text fields. Use BLANKVALUE in new formulas. BLANKVALUE has the same functionality as NULLVALUE but also supports text fields.

NULLVALUE(expression, substitute_expression_if_null)

Where:

  • expression is the expression you want to evaluate

  • substitute_expression_if_null is the value you want to replace any blank values

Logical
IF

Determines if expressions are true or false. Returns a given value if true and another value if false.

IF(logical_test, value_if_true, value_if_false)

Where:

  • logical_test is the expression you want to evaluate

  • value_if_true is the value you want the system to return if the expression is true

  • value_if_false is the value you want the system to return if the expression is false

NOT

Evaluates an expression and returns FALSE if the expression is TRUE and TRUE if the expression is FALSE.

NOT(expression)

Where:

  • expression is the expression you want to evaluate

Math
MAX

Returns the highest number from a list of numbers.

MAX(number1,number2,...number_n)

Where:

  • number1, number2,...number_n are the fields or expressions you want evaluating to retrieve the highest number

MIN

Returns the lowest number from a list of numbers.

MIN(number1, number2,...number_n)

Where:

  • number1, number2,...number_n are the fields or expressions you want evaluating to retrieve the lowest number

Text
ESCAPE

Converts a text value to include characters compatible with HTML markup.

Replaces... With...
& &amp:
< &lt;
> &gt;

ESCAPE(text_string)

Where:

  • text_string is the text you want to escape to HTML markup

ISPICKVAL

Determines if the value of a picklist field is equal to a text literal you specify.

ISPICKVAL(picklist_field, text_literal)

Where:

  • picklist_field is the merge field name for the picklist

  • text_literal is the picklist value in quotes. text_literal can't be a merge field or the result of a function

REPLACE

Replaces old text with new text, when old text is found in the specified source.

REPLACE(text,old_text,new_text)

Where:

  • text is the field or expression you want to search for the text you want to replace

  • old_text is the string you want to find and replace

  • new_text is the text you want to use to replace old_text in text

UNESCAPE

Converts a string containing HTML markup into the text equivalent.

Replaces... With...
&amp; &
&lt; <
&gt; >

UNESCAPE(text_string)

Where:

  • text_string is the text you want to escape from HTML markup