Skip to content

Start a Subworkflow and Control Parent Continuation

Goal

Start one child instance per selected row and choose explicitly whether the parent continues immediately or waits for the child instances to finish and synchronize their results.

What You Will Learn

  • bind subworkflow creation to repeating XML rows
  • choose between continue and wait modes
  • correlate and synchronize child results with stable row IDs

Difficulty and Estimated Time

  • Difficulty: Advanced
  • Estimated time: 25 minutes

Assumed Knowledge

You should understand pools, module tasks, repeating XML rows, and parent/child process data.

Required Reading

Prerequisites

  • permission to import a definition containing two pools
  • one or more test rows under Items/Item, each with a stable Id

Example Overview

The parent pool contains a subworkflow module and a completion task. The child pool contains one task that updates the row passed by its parent.

Steps

Bind Child Instances to Rows

Configure the subworkflow module with:

1
2
3
4
5
6
<SubWorkflow Pool="..." Task="..." Mode="WaitForAllChildsToComplete">
  <XPath><![CDATA[Items/Item]]></XPath>
  <ConditionXPath><![CDATA[not(@State = 'Deleted')]]></ConditionXPath>
  <RowIdXPath><![CDATA[Id]]></RowIdXPath>
  <SyncXPath><![CDATA[Items/Item]]></SyncXPath>
</SubWorkflow>

RowIdXPath provides stable correlation. Do not use row position because insertion or deletion can change it.

Choose the Parent Behavior

  • CreateInstancesAndContinue starts the children and lets the parent route onward immediately.
  • WaitForAllChildsToComplete pauses the module until every child finishes.
  • SynchronizeChildInstancesAndContinue is useful when the parent should continue while later synchronization remains part of the design.

The downloadable example uses WaitForAllChildsToComplete so the final parent task can verify synchronized status.

How It Works

The module selects source rows, starts a child for each matching row, and correlates results by Id. Waiting controls workflow timing; synchronization controls how child data returns. They are separate design decisions.

Verify the Result

  1. Import the definition and add two rows with different IDs.
  2. Start the subworkflow action and confirm that two child tasks are created.
  3. Complete one child and confirm that the parent still waits.
  4. Complete the second child and confirm that the parent advances with both row statuses synchronized.
  5. In a copy, switch to CreateInstancesAndContinue and confirm that the parent advances immediately.

Failure and Edge Cases

  • Duplicate or empty row IDs must be rejected before child creation.
  • Decide how the parent handles a cancelled or failed child instead of waiting indefinitely.
  • Do not allow deleted rows to start new children.

Security and Portability Notes

  • Both pools execute in the current tenant; configure child-task roles after import.
  • Pass only data the child requires and re-check authorization for child-side actions.
  • Keep stable correlation IDs and define retry behavior before allowing the module to run twice.

Download and Try It Yourself

Download the parent/child workflow definition.

Troubleshooting

  • No child is created: Check the row XPath, condition, target pool, and target task.
  • Results update the wrong row: Confirm every row has a unique stable Id and the same synchronization path.
  • Parent never advances: Confirm every child reached a terminal state and review the selected mode.

What to Learn Next