Skip to content

Conditional

This module contains step implementations for the Conditional task.

When conditional if

When condition "{condition}" with name "{name}" is true, execute these tasks

[view_source]

Create an instance of the Conditional task which executes different sets of task depending on condition.

Also sets the task in a state that any following tasks will be run when condition is true.

See Conditional task documentation for more information.

Example:

When condition "{{ value | int > 0 }}" with name "value-conditional" is true, execute these tasks
Then get request with name "get-when-true" from endpoint "/api/true"
Then parse date "2022-01-17 12:21:37 | timezone=UTC, format="%Y-%m-%dT%H:%M:%S.%f", offset=1D" and save in variable "date1"
But if condition is false, execute these tasks
Then get request with name "get-when-false" from endpoint "/api/false"
Then end condition

Then conditional else

Then if condition is false, execute these tasks

[view_source]

Change state of Conditional task instance created by step_task_conditional_if so that any following tasks will be run when condition is false.

See Conditional task documentation for more information.

Example:

When condition "{{ value | int > 0 }}" with name "value-conditional" is true, execute these tasks
Then get request with name "get-when-true" from endpoint "/api/true"
Then parse date "2022-01-17 12:21:37 | timezone=UTC, format="%Y-%m-%dT%H:%M:%S.%f", offset=1D" and save in variable "date1"
But if condition is false, execute these tasks
Then get request with name "get-when-false" from endpoint "/api/false"
Then end condition

Then conditional end

Then end condition

[view_source]

Close the Conditional task instance created by step_task_conditional_if.

This means that any following tasks specified will not be part of the conditional.

See Conditional task documentation for more information.

Example:

When condition "{{ value | int > 0 }}" with name "value-conditional" is true, execute these tasks
Then get request with name "get-when-true" from endpoint "/api/true"
Then parse date "2022-01-17 12:21:37 | timezone=UTC, format="%Y-%m-%dT%H:%M:%S.%f", offset=1D" and save in variable "date1"
But if condition is false, execute these tasks
Then get request with name "get-when-false" from endpoint "/api/false"
Then end condition