Skip to main content
Version: v5.0

Switch

Overview#

The Switch task is a control flow that enables conditional branching within a workflow. It evaluates an expression or variable at runtime and then routes execution into one of several defined decisionCases.

Sample request#

{    "_name": "switch_task",    "_type": "SWITCH",    "_sequenceno": 1,    "_inputParams": {        "_switchCaseValue": "${task1._output._userInput.userChoice}"    },    "_decisionCases": {        "approved": [            {                "_name": "rest_connector_task_1",                "_type": "REST_CONNECTOR",                "_sequenceno": 1,                "_inputParams": {                    "_url": "<URL>",                    "_auth": {                        "_type": "NoAuth"                    }                }            }        ],        "rejected": [            {                "_name": "rest_connector_task_2",                "_type": "REST_CONNECTOR",                "_sequenceno": 1,                "_inputParams": {                    "_url": "<URL>",                    "_auth": {                        "_type": "NoAuth"                    }                }            }        ],        "defaultCase": [            {                "_name": "rest_connector_task_3",                "_type": "REST_CONNECTOR",                "_sequenceno": 1,                "_inputParams": {                    "_url": "<URL>",                    "_auth": {                        "_type": "NoAuth"                    }                }            }        ]    }}
ParameterTypeDescription
_nameStringNo
_typeStringYes
_sequencenoNumberNo
_inputParamsObjectNo
_switchCaseValueStringYes
_decisionCasesObjectYes