Omnistudio Conditional Functions

Functions that perform conditional operations.

  • Omnistudio IF Function
    Evaluates an expression to determine whether it's true or false and returns the indicated response. If the expression evaluates to true, the function returns the true (first) result. Otherwise, the function returns the false (second) result.
  • Omnistudio ISBLANK Function
    Returns true if an expression is blank or empty. Otherwise, the function returns false.
  • Omnistudio ISNOTBLANK Function
    Returns true if an expression is not blank or empty. Otherwise, the function returns false.

Omnistudio IF Function

Evaluates an expression to determine whether it's true or false and returns the indicated response. If the expression evaluates to true, the function returns the true (first) result. Otherwise, the function returns the false (second) result.

Important
Important

Both the true and false branches are always evaluated and it returns the result of the false branch. This becomes significant when either branch contains operations with side effects (such as InvokeIP, , DML operations, or callouts), because actions in the true branch may still execute even when the condition is false.

For example:

IF(
    ISNOTBLANK(Account.Id),
    InvokeIP(
        'AccountCreateIP_AccountCreateIP',
        INPUT('SomeKey', 'SomeVal'),
        'OutputKey'
    ),
    'IP Not Called'
)

In this example, even if Account.Id is blank (which should lead to returning "IP Not Called"), the InvokeIP function in the true branch is still evaluated.

Signature

IF(expression, trueResult, falseResult)

Return Value

Any data type

Parameters

Parameter

Data Type

Necessity

Description

expression

Expression

Required

An expression that resolves to true or false.

trueResult

Expression

Required

An expression that resolves to the value to be returned if the expression parameter is true.

falseResult

Expression

Required

An expression that resolves to the value to be returned if the expression parameter is false.

String Comparison Example
String Comparison Example

Formula: IF(("abc" LIKE "a"), "true", "false")

Return value: "true"

String Comparison Example
String Comparison Example

Formula: IF(("a" LIKE "abc"), "true", "false")

Return value: "false"

Evaluate a Date Example
Evaluate a Date Example

Sample data: InputDate: "1999-07-01"

Formula: IF(InputDate < "2000-01-01", "20th Century", "21st Century")

Return value: "20th Century"

Parse a Substring Example
Parse a Substring Example

Sample data: "Price": "$800.00"

Formula: IF(SUBSTRING(Price, 0, 1) == "$", SUBSTRING(Price, 1), Price)

Return value: "800.00"

Avoid Division by Zero Example
Avoid Division by Zero Example

Sample data: "Amount": 2

Formula: IF(Amount > 0, 1 / IF(Amount > 0, Amount, 1), 0)

Return value: 0.5

Avoid Division by Zero Example
Avoid Division by Zero Example

Sample data: "Amount": 0

Formula: IF(Amount > 0, 1 / IF(Amount > 0, Amount, 1), 0)

Return value: 0

Alternative Division by Zero Example
Alternative Division by Zero Example

Sample data: "Amount": 0

Formula: IF(Amount > 0, 1 / IF(Amount > 0, Amount, 1), "Undefined")

Return value: "Undefined"

Omnistudio ISBLANK Function

Returns true if an expression is blank or empty. Otherwise, the function returns false.

Signature

ISBLANK(expression)

Return Value

Boolean

Parameters

Parameter

Data Type

Necessity

Description

expression

String or list

Required

An expression that resolves to a string or list to determine whether it is empty.

String Example
String Example

Formula: ISBLANK("")

Return value: true

List Example
List Example

Formula: ISBLANK(())

Return value: true

Array Example
Array Example

Formula: ISBLANK([])

Return value: true

JSON Array Example
JSON Array Example

Sample data: "EmptyList": []

Formula: ISBLANK(%EmptyList%)

Return value: true

Omnistudio ISNOTBLANK Function

Returns true if an expression is not blank or empty. Otherwise, the function returns false.

Signature

ISNOTBLANK(expression)

Return Value

Boolean

Parameters

Parameter

Data Type

Necessity

Description

expression

String or list

Required

An expression that resolves to a string or list to determine whether it is not empty.

String Example
String Example

Formula: ISNOTBLANK('Hello world')

Return value: true

List Example
List Example

Formula: ISNOTBLANK(("a", "b"))

Return value: true

Array Example
Array Example

Formula: ISNOTBLANK([1, 2])

Return value: true

JSON Array Example
JSON Array Example

Sample data: "NumberList": [1, 2]

Formula: ISNOTBLANK(%NumberList%)

Return value: true