Codemation Docs
NodesCore

Sub Workflow

Invoke another workflow as part of the current workflow graph.

… stars

Sub Workflow

Description

SubWorkflow runs another workflow from inside the current workflow. Use it when you want to compose larger flows from smaller reusable ones.

Examples

Basic usage: hand off an item to a reusable workflow

new SubWorkflow("Run shared enrichment flow", "wf.shared.enrichment");

Example input:

{
  "customerId": "cus_9"
}

Example output:

{
  "customerId": "cus_9",
  "enriched": true,
  "segment": "enterprise"
}

Advanced usage: resume a sub-workflow from a specific node

new SubWorkflow(
  "Resume invoice remediation flow",
  "wf.invoice.remediation",
  [{ nodeId: "collect_invoice_context" }],
  "retry_failed_delivery",
  "subflow_retry_invoice",
);

Example input:

{
  "invoiceId": "inv_42",
  "retryCount": 2
}

Example output:

{
  "invoiceId": "inv_42",
  "retryCount": 2,
  "deliveryStatus": "scheduled"
}

On this page