The evaluation task replaced the decision task deprecated in the Gen 2 workflow canvas for 2023.2 ➤ Deprecation Notice: Decision Task Replaced
The evaluation task controls workflow execution paths based on runtime conditions. Use this task to compare values and determine which path your workflow should follow.
When the task's conditions are met, the task outputs true and execution continues through any success transitions. Otherwise, the task outputs undefined and execution continues through any failure transitions.
This guide covers:
- Setting the task condition
- Constructing evaluations
- Using operators with different data types
Output behavior changes in Platform 2023.1+
If you're migrating workflows from Platform 2022.1 to Platform 2023.1 or later, be aware of a change in how the evaluation task displays its output when the fail path is taken.
| Version | Fail path output |
|---|---|
| Platform 2022.1 | Returns "return_value": "null" |
| Platform 2023.1+ | Returns nothing (field is absent or empty) |
This change affects only how the outcome appears in the job/task view and API responses, not how your workflow executes.
When validating migrated workflows, check the transition path to confirm whether the success or fail path was taken, rather than relying on the return value field.
Type inference and coercion
By default, the evaluation task automatically performs type inference and coercion:
-
First operand: If the first operand can be parsed from a string into another type, the task converts it automatically. For example, the string
"500"is converted to the number500. -
Second operand: The task attempts to convert the second operand to match the first operand's type. If conversion isn't possible, the evaluation rule fails.
Enable strict types
You can disable type coercion by enabling Strict Types mode. When enabled, the task compares operands exactly as provided without any type conversion.
To enable strict types:
- Open the task configuration window.
- Click the Options tab.
- Enable the Strict Types toggle.

Strict types comparison
The following example shows how the != operator behaves differently based on the strict types setting:
| Operand A | Operator | Operand B | Strict Types | Result | Explanation |
|---|---|---|---|---|---|
"500" |
!= |
"Hello" |
Off | false (fails) |
"500" is coerced to 500, then "Hello" can't be coerced to a number, so the rule fails. |
"Hello" |
!= |
"500" |
Off | true |
"Hello" can't be coerced, so both remain strings. The strings aren't equal. |
"500" |
!= |
"Hello" |
On | true |
No coercion occurs. Both are compared as strings, which aren't equal. |
"Hello" |
!= |
"500" |
On | true |
No coercion occurs. Both are compared as strings, which aren't equal. |
Tip: Enable strict types when you need predictable string comparisons without automatic type conversion.
Construct an evaluation
Evaluations are expressions consisting of two operands (A and B) and a comparison operator. When the task runs, it compares operand A to operand B and yields true or false.
Tip: By default, evaluations display vertically. To display them horizontally, click Expand at the top-right of the task configuration window.
Evaluation groups
All evaluations belong to an evaluation group. Each group resolves to true or false by logically combining its evaluation results. Each group has its own conditional statement that works the same way as the task condition.
Create an evaluation
- Click + Add Evaluation Group to create a new group (if one doesn't exist).
- Click + Add Evaluation in the desired group.
- Define operand A using one of these sources:
- Static: Specify a data type and value.
- Job variable: Select the variable from the dropdown menu.
- Previous task: Select the task and its relevant variable from the dropdown menu.
- Select the comparison operator from the Operator dropdown menu.
- Define operand B.
Use queries with arrays and objects
If operand A is an array or object, you can use a query to determine its value:
- Select the Enable Query checkbox.
- Enter your query using the same syntax as the
querytask.
At runtime, the query executes and its results become the value of operand A.
# Operator reference
Operator behavior depends on the data types of the operands.
Contains
| Operand A type | Operand B type | Behavior |
|---|---|---|
string |
string |
Returns true if B is a substring of A. Supports JavaScript RegExp patterns. Limitations: Template variables aren't supported for operand B; operand B can't be a string of numbers. |
boolean |
boolean |
Returns true if A equals B. |
number |
number |
Returns true if A divided by B has no remainder. |
array |
string, boolean, or number |
Returns true if B is an element of A. |
array |
object or array |
Always returns false. |
object |
string |
With query: Returns true if the query matches a property name in A and B is a substring of that property. Without query: Returns true if B is a substring of any property in A. |
object |
number, object, or array |
With query: Returns true if the query matches a property name in A and B is contained by that property. |
Does not contain
| Operand A type | Operand B type | Behavior |
|---|---|---|
string |
string |
Returns true if B is not a substring of A. |
boolean |
boolean |
Returns true if A doesn't equal B. |
number |
number |
Returns true if A divided by B has a remainder. |
array |
string, boolean, or number |
Returns true if B is not an element of A. |
array |
object or array |
Always returns false. |
object |
string |
With query: Returns true if the query doesn't match a property name in A, or B isn't a substring of that property. Without query: Returns true if B isn't a substring of any property in A. |
object |
number, object, or array |
With query: Returns true if the query doesn't match a property name in A, or B isn't contained by that property. |
Greater than (>)
| Operand A type | Operand B type | Behavior |
|---|---|---|
string |
string |
Compares using lexicographical ordering. |
boolean |
boolean |
true is greater than false. |
number |
number |
Returns true if A is greater than B. |
array |
number |
Returns true if B is less than A's length. |
array |
array |
Returns true if A's length is greater than B's length. |
object |
any | Always returns false. |
Less than (<)
| Operand A type | Operand B type | Behavior |
|---|---|---|
string |
string |
Compares using lexicographical ordering. |
boolean |
boolean |
true is greater than false. |
number |
number |
Returns true if A is less than B. |
array |
number |
Returns true if B is greater than A's length. |
array |
array |
Returns true if A's length is less than B's length. |
object |
any | Always returns false. |
Equals (==)
| Operand A type | Operand B type | Behavior |
|---|---|---|
string |
string |
Returns true if A equals B. |
boolean |
boolean |
Returns true if A equals B. |
number |
number |
Returns true if A equals B. |
array |
number |
Returns true if B equals A's length. |
array |
array |
Returns true if A and B have the same length. |
object |
object |
Returns true if A and B have the same properties and values. |
Does not equal (!=)
| Operand A type | Operand B type | Behavior |
|---|---|---|
string |
string |
Returns true if A doesn't equal B. |
boolean |
boolean |
Returns true if A doesn't equal B. |
number |
number |
Returns true if A doesn't equal B. |
array |
number |
Returns true if B doesn't equal A's length. |
array |
array |
Returns true if A and B have different lengths. |
object |
object |
Returns true if A and B have different properties or values. |
Greater than or equal to (>=)
| Operand A type | Operand B type | Behavior |
|---|---|---|
string |
string |
Compares using lexicographical ordering. |
boolean |
boolean |
true is greater than false. |
number |
number |
Returns true if A is greater than or equal to B. |
array |
number |
Returns true if B is less than or equal to A's length. |
array |
array |
Returns true if A's length is greater than or equal to B's length. |
object |
object |
Always returns false. |
Less than or equal to (<=)
| Operand A type | Operand B type | Behavior |
|---|---|---|
string |
string |
Compares using lexicographical ordering. |
boolean |
boolean |
true is greater than false. |
number |
number |
Returns true if A is less than or equal to B. |
array |
number |
Returns true if B is greater than or equal to A's length. |
array |
array |
Returns true if A's length is less than or equal to B's length. |
object |
object |
Always returns false. |
Examples
The following examples demonstrate evaluation results for different operand combinations.
String comparisons with contains
| Operand A | Operator | Operand B | Result |
|---|---|---|---|
"er1.atl" |
contains |
"atl" |
true |
"er1.atl" |
contains |
"ATL" |
false |
Array comparisons with contains
| Operand A | Operator | Operand B | Result |
|---|---|---|---|
["cr1.atl", "er1.atl"] |
contains |
"er1.atl" |
true |
["cr1.atl", "er1.atl"] |
contains |
"atl" |
false |
Object comparisons with contains
| Operand A | Operator | Operand B | Result |
|---|---|---|---|
{"name": "apple", "color": "red"} |
contains |
"color" |
true |
{"name": "apple", "color": "red"} |
contains |
"apple" |
false |
Regular expression patterns
| Operand A | Operator | Operand B | Result |
|---|---|---|---|
a1111z |
contains |
a[\d][\d][\d][\d]z |
true |
a1111z |
contains |
a[\D][\D][\D][\D]z |
false |
a1111z |
contains |
a[\d]+z |
true |
white space |
contains |
[\s] |
true |
Numeric comparisons
| Operand A | Operator | Operand B | Result |
|---|---|---|---|
4 |
> |
2 |
true |
1 |
> |
2 |
false |
6 |
< |
9 |
true |
6 |
== |
6 |
true |
6 |
== |
"6" |
true |
6 |
!= |
7 |
true |
4 |
>= |
4 |
true |
6 |
<= |
9 |
true |
Boolean comparisons
| Operand A | Operator | Operand B | Result |
|---|---|---|---|
true |
> |
false |
true |
false |
< |
true |
true |
false |
== |
false |
true |
false |
== |
"FALSE" |
true |
true |
!= |
false |
true |
Array length comparisons
| Operand A | Operator | Operand B | Result |
|---|---|---|---|
["cr1.atl", "er1.atl"] |
> |
1 |
true |
["cr1.atl", "er1.atl"] |
> |
["cr2.atl"] |
true |
["cr1.atl", "er1.atl"] |
< |
3 |
true |
["cr1.atl", "er1.atl"] |
== |
["cr1.atl", "er1.atl"] |
true |
Object comparisons
| Operand A | Operator | Operand B | Result |
|---|---|---|---|
{"name": "cr1.atl", "ned": "cisco-ios-xr", "slots": 8} |
== |
{"name": "cr1.atl", "ned": "cisco-ios-xr", "slots": 8} |
true |
{"name": "cr1.atl", "ned": "cisco-ios-xr", "slots": 8} |
== |
{"name": "cr1.atl", "ned": "cisco-ios-xr", "slots": "8"} |
false |
{"name": "cr1.atl", "ned": "cisco-ios-xr", "slots": 8} |
!= |
{"name": "cr2.atl", "ned": "cisco-ios-xr", "slots": 8} |
true |
Error cases
Some comparisons result in errors:
| Operand A | Operator | Operand B | Result |
|---|---|---|---|
"chassis" |
> |
"card" |
error |
"card" |
< |
"chassis" |
error |
"chassis" |
>= |
"card" |
error |
"card" |
<= |
"chassis" |
error |