
Core Plugins and tasks Switch
CertifiedRoute to task groups based on a value.
Core Plugins and tasks Switch
Certified
Route to task groups based on a value.
Renders value and matches it against cases keys; executes the corresponding task list or defaults if no match. Supports errors and finally blocks.
Useful for branching on categorical inputs without nesting multiple Ifs.
yaml
type: io.kestra.plugin.core.flow.SwitchExamples
yaml
id: switch
namespace: company.team
inputs:
- id: string
type: STRING
required: true
tasks:
- id: switch
type: io.kestra.plugin.core.flow.Switch
value: "{{ inputs.string }}"
cases:
FIRST:
- id: first
type: io.kestra.plugin.core.debug.Return
format: "{{ task.id }} > {{ taskrun.startDate }}"
SECOND:
- id: second
type: io.kestra.plugin.core.debug.Return
format: "{{ task.id }} > {{ taskrun.startDate }}"
THIRD:
- id: third
type: io.kestra.plugin.core.debug.Return
format: "{{ task.id }} > {{ taskrun.startDate }}"
defaults:
- id: default
type: io.kestra.plugin.core.debug.Return
format: "{{ task.id }} > {{ taskrun.startDate }}"
Properties
value *Requiredstring
The value to be evaluated
cases Non-dynamicobject
SubTypearray
The map of keys and a list of tasks to be executed if the conditional value matches the key
defaults Non-dynamicarray
errors Non-dynamicarray
List of tasks to run if any tasks failed on this FlowableTask.
finally Non-dynamicarray
pluginDefaultsRef Non-dynamicstring
Reference (ref) of the pluginDefaults to apply to this task.
Outputs
defaults boolean
Default
false