Call a Sub-Workflow v2

Create a child Workflow with a deliberate Parameter and Return contract, publish it, then add it to the parent as a Sub-Workflow Step.

Prepare the child Workflow

  1. Create or open the child Workflow in the Test Environment.
  2. Define its Workflow Parameters and Returns.
  3. Map each Workflow Return to the final value the parent should receive.
  4. Run the child directly with representative Parameter values.
  5. Save it and confirm that the Test revision is published.
  6. Confirm that its Test status is Enabled.

Add the call to the parent

  1. Open the parent Workflow in Design.
  2. Click the + control at the required position.
  3. Search for and select Sub Workflow.
  4. Select CallWorkflow.
  5. Select the published child Workflow from the template list.

The generated Step sets WorkflowKey to the child's stable key and adds the child's published Parameters and Returns. v1 Runtime targets are marked (v1).

If the intended child is absent, confirm that it has been saved and published. The runtime call is Site-local; use a Workflow in the same Site.

Map inputs and outputs

Map each child Parameter on the Sub-Workflow Step:

  • Use Value for a literal.
  • Use Expression to map a parent Workflow Parameter or an earlier Step Return.
  • Map object and array children to the shape declared by the child.

Downstream Steps refer to each Sub-Workflow Return by the call Step name. For example, if the Step is named callCustomer and the child defines a customerId Return, use:

{callCustomer.customerId}

The authored YAML follows this structure:

Steps:
  - Name: callCustomer
    Node: v2.SubWorkflow@latest
    Method: CallWorkflow
    TemplateKey: <child-workflow-key>
    Parameters:
      WorkflowKey:
        Type: string
        Value: <child-workflow-key>
      externalId:
        Type: string
        Expression: "{.externalId}"
    Returns:
      customerId:
        Type: string

Use the template generated by Flowgear for production definitions. It supplies the exact bundled Node version and the published target contract.

Test the call

  1. Run the parent in the same Environment in which you published the child.
  2. Open Logs.
  3. Inspect the Sub-Workflow call row for its mapped Parameters and Returns.
  4. Expand or inspect the nested rows to follow the child's Steps under the same Workflow instance.
  5. Verify a downstream Step or parent Workflow Return that consumes the child output.

If the child raises an error, the parent call fails. Put the call in a TryCatch container when the parent has a deliberate recovery path.

Release parent and child

Every Environment resolves its own published child revision. Promote the child first, then promote the parent that depends on its contract. Confirm that both Workflows are enabled in the target Environment.

When the child contract changes, use Refresh Sub-Workflow Properties in each parent and review every preserved mapping before release.

See also

See Sub-Workflows for runtime, Cluster, timeout, and cross-runtime behavior.