You can define multiple independent branches within your workflow and select one based on an expression value.
Hook up your branches via the SelectNextStep property, instead of a NextStepId. The expressions will be matched to the step Ids listed in SelectNextStep, and the matching next step(s) will be scheduled to execute next.
{
"Id": "DecisionWorkflow",
"Version": 1,
"DataType": "MyApp.MyData, MyApp",
"Steps": [
{
"Id": "decide",
"StepType": "...",
"SelectNextStep":
{
"Branch1": "<<result expression to match for branch 1>>",
"Branch2": "<<result expression to match for branch 2>>"
}
},
{
"Id": "Branch1",
"StepType": "MyApp.PrintMessage, MyApp",
"Inputs":
{
"Message": "\"Hello from 1\""
}
},
{
"Id": "Branch2",
"StepType": "MyApp.PrintMessage, MyApp",
"Inputs":
{
"Message": "\"Hello from 2\""
}
}
]
}
Id: DecisionWorkflow
Version: 1
DataType: MyApp.MyData, MyApp
Steps:
- Id: decide
StepType: WorkflowCore.Primitives.Decide, WorkflowCore
Inputs:
Expression: <<input expression to evaluate>>
OutcomeSteps:
Branch1: '<<result expression to match for branch 1>>'
Branch2: '<<result expression to match for branch 2>>'
- Id: Branch1
StepType: MyApp.PrintMessage, MyApp
Inputs:
Message: '"Hello from 1"'
- Id: Branch2
StepType: MyApp.PrintMessage, MyApp
Inputs:
Message: '"Hello from 2"'
Decision Branches
You can define multiple independent branches within your workflow and select one based on an expression value. Hook up your branches via the
SelectNextStep
property, instead of aNextStepId
. The expressions will be matched to the step Ids listed inSelectNextStep
, and the matching next step(s) will be scheduled to execute next.