# convertToBoolean

A Workflow Engine function that converts a string value to a Boolean (true or false) value which is similar to the \$TO_BOOLEAN() payload macro. Recognized true and false values are converted to Booleans. If the value is not a recognized true value, then the result is set to false.

Value

convertToBoolean Result

“false”

false

“no”

false

0 (integer or string)

false

None of the above

false

“true”

true

“yes”

true

1 (integer or string)

true

This function is available for event, alert, and Situation workflows.

## Arguments

Workflow Engine function convertToBoolean takes the following arguments:

Name

Required

Type

Description

source

yes

string

The CEvent or workflowContext field to apply the conversion to.

destination

no

string

The CEvent or workflowContext field to write the converted value to. Defaults to the source if not specified.

## Example

To convert a custom_info.isServer field with a value of “true” to a real Boolean, writing the result to the same source field:

• source : custom_info.isServer

• destination : <not set>

The source value:

"custom_info" : {
"isServer" : "true"
}

is replaced by the equivalent Boolean:

"custom_info" : {
"isServer" : true
}