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" } } } ] }}| Parameter | Type | Description |
|---|---|---|
_name | String | No |
_type | String | Yes |
_sequenceno | Number | No |
_inputParams | Object | No |
_switchCaseValue | String | Yes |
_decisionCases | Object | Yes |