Use Branch by Stage to organize child steps into named stages and move between those stages while a workflow runs. A Set Next Stage child step can select another configured stage or leave the stage container.
Step Library: Flow Control > Branching & Conditions
When to use this step
Use this step when you want to:
- model a workflow as a sequence of named stages;
- decide the next stage from within the currently running stage;
- revisit a previous stage or select a stage dynamically from a Text variable.
Use Branch by Value instead when one value should select a single branch and the container should not transition between branches.
Use Branch by Condition instead when one condition group should select exactly one of two branches.
Before you begin
This step does not require a connection or special permissions.
Plan at least two stages. If Set Next Stage uses a variable, create or identify a Text variable whose runtime value exactly matches a configured Stage key.
Configure the step
- Add Branch by Stage from Flow Control > Branching & Conditions.
- Select the step to open its configuration panel.
- Select the Initial stage. The first stage is selected by default.
- Under Stages, enter a unique Stage key for each stage and optionally change its Label (optional).
- Use Add stage to create more stages, and reorder or delete stages as needed. At least two stages must remain.
- Add child steps to each stage.
- Where a stage should transition, add Set Next Stage and select a configured stage, a Text variable, or Exit stages.
- Save or publish the workflow.
Settings
| Setting | Required | Accepted values | Visible when | Description |
|---|---|---|---|---|
| Initial stage | Yes | One configured stage; fixed value only | Always | Selects the first stage to execute. The default is the first stage, initially Stage 1. If the selected stage is deleted, the first remaining stage becomes the initial stage. |
| Stages | Yes | Two or more ordered stages | Always | Defines the available stage branches. Two stages, Stage 1 and Stage 2, exist by default. Add stage creates another stage with the first unused Stage N key. Stages can be reordered. Deletion is disabled while only two stages remain. There is no step-specific maximum beyond general workflow limits. |
| Stage key | Yes | Non-empty fixed Text, unique per stage | Each stage | Identifies the stage for dynamic routing. The initial keys are Stage 1 and Stage 2; an added stage receives the first unused Stage N key. Keys must contain non-whitespace text and must be unique ignoring case. A dynamic Set Next Stage value must match the configured key exactly, including letter case. Changing a key can therefore affect variable-based transitions. |
| Label (optional) | No | Fixed Text or not set | Each stage | Changes the stage label shown in the Designer. The two initial labels are Stage 1 and Stage 2. If a label is cleared, the Stage key is used as the display fallback. The label does not replace the key used for dynamic routing. |
Reordering or relabeling a stage does not change the stable stage selection used by a fixed Set Next Stage value. Deleting a stage makes any fixed Set Next Stage reference to that stage invalid.
Data and outputs
Workflow variable effects
This step does not directly modify workflow variables.
Child steps can modify workflow variables. A change becomes available to later child steps, later stages, and steps following Branch by Stage. If execution suspends, current workflow-variable values are included in the suspension state and remain available after resume.
Step outputs
This step does not expose step outputs.
Outputs produced by a child step are available to later child steps in the same stage execution. They leave scope when that stage completes and are not available in another stage or after Branch by Stage.
Runtime behavior
Execution and completion
When execution reaches Branch by Stage, Flowifier runs the selected Initial stage. Child steps in that stage run sequentially in their configured order.
After a stage completes, the next action depends on Set Next Stage:
| Stage result | Behavior |
|---|---|
| A fixed configured stage is selected | Flowifier runs that stage next. The fixed selection follows the selected stage even if its key, label, or position changes. |
| A Text variable resolves to a configured stage key | Flowifier runs the stage whose Stage key exactly matches the resolved Text value. Matching is case-sensitive. |
| Exit stages is selected | Flowifier leaves Branch by Stage and continues with the next workflow step. |
| No Set Next Stage runs | Branch by Stage completes after the current stage and the workflow continues with the next step. |
A stage can transition to an earlier stage or to itself. Flowifier allows up to 1,000 stage executions within one Branch by Stage run. If another stage execution would exceed that guard, the step fails.
Branch by Stage does not call an external provider and has no external side effects of its own.
Branches and child steps
Each configured stage is a branch. Only one stage runs at a time, and stages do not automatically run in their displayed order. The initial selection and each completed Set Next Stage action determine the execution path.
Child steps execute sequentially. Workflow-variable changes made by a child step remain available across stage transitions. Child step outputs remain limited to the stage execution in which they were created.
Child steps retain their own external side effects. Branch by Stage does not roll back a completed child action when a later child action or stage fails. Restarting the workflow can therefore repeat an external side effect, and manual recovery may be required.
Failure, retry and resume behavior
Branch by Stage does not perform automatic retries.
If a child step fails, is cancelled, terminates the workflow, or ends the workflow, Branch by Stage stops immediately and propagates that result. End Workflow completes the workflow successfully without running later stages or steps after the container. Terminate Workflow marks the instance as terminated. Cancelling the instance marks it as cancelled and prevents a pending timer from resuming it.
If a child step suspends the workflow, Branch by Stage suspends with it and stores the current stage, transition state, and stage-execution count. When the workflow resumes, execution continues from the suspended child in the same stage. Child steps completed before suspension do not run again.
Errors and limits
| Situation | Result | Resolution |
|---|---|---|
| Fewer than two stages are configured | The workflow cannot be published. The Designer prevents deleting a stage when only two remain. | Add stages until at least two are configured. |
| Initial stage is missing or no longer exists | The workflow cannot be published. | Select an existing stage as Initial stage. |
| A Stage key is empty or contains only whitespace | The Designer shows Enter a stage key., and the workflow cannot be published. | Enter a non-empty key. |
| Two Stage key values differ only by letter case | The Designer shows Stage keys must be unique., and the workflow cannot be published. | Give every stage a key that is unique ignoring case. |
| A fixed Set Next Stage selection refers to a deleted stage | Set Next Stage shows Next stage does not exist, and the workflow cannot be published. | Select an existing stage or Exit stages. |
| A Text variable used by Set Next Stage is empty or unset | Set Next Stage fails, and the workflow instance becomes faulted. | Set the Text variable to a configured key before Set Next Stage runs. |
| A Text variable does not exactly match a configured Stage key | The current stage finishes, then Branch by Stage fails. Later stages and steps after the container do not run, and the instance becomes faulted. | Correct the value, including letter case, so that it exactly matches a configured key. |
| Stage execution would exceed 1,000 executions | Branch by Stage fails and the workflow instance becomes faulted. | Change the transition logic so that the stages reach an exit condition within 1,000 executions. |
| A child step fails | The current stage stops, the failure is propagated, and later stages do not run. | Inspect the failed child step under Instance Activities. |
| A child step creates an external side effect before a later failure | The completed external side effect is not rolled back. | Review the child step's recovery guidance before retrying or restarting the workflow to avoid duplicate side effects. |
This step has no additional limits beyond the stage-execution guard, the general workflow limits, and the limits of its child steps.
Example
Move a document from draft to review
Goal: Run drafting steps, move to review, and then continue after the stage container.
Configuration:
- Initial stage:
Draft - First Stage key:
draft - First Label (optional):
Draft - Second Stage key:
review - Second Label (optional):
Review - Final Draft child step: Set Next Stage with Next stage =
Review - Final Review child step: Set Next Stage with Next stage = Exit stages
Add the drafting child steps before Set Next Stage in the Draft stage. Add the review child steps before Set Next Stage in the Review stage.
Result: Flowifier runs Draft first, then Review, and then continues with the next workflow step after Branch by Stage. Workflow-variable changes made during Draft remain available during Review and after the container. Direct outputs from Draft child steps are not available in Review.
Related information
- Set Next Stage — select another configured stage dynamically or leave the stage container.
- Branch by Condition — select one of two branches by evaluating conditions.
- Branch by Value — select one branch by comparing a value with configured branch values.
- Workflow variables — retain values across stages and after the container.
Comments
0 comments
Please sign in to leave a comment.