Portal Community

Example 1 — Reusable Approval Sub-Process

Multiple parent workflows (purchase orders, expense claims, contract amendments) all require a multi-level approval process. Instead of duplicating the approval logic, define it once as a child workflow and invoke it from each parent.

{
  "node_type": "SubWorkflow",
  "name": "RunApprovalProcess",
  "config": {
    "sub_workflow_id": "approval-workflow-guid-here",
    "sub_workflow_version_id": 2,
    "input_data": {
      "requestType":  "purchase_order",
      "requestId":    "{@ var.poNumber }",
      "amount":       "{@ var.poTotal }",
      "requestorEmail": "{@ var.submitterEmail }"
    }
  }
}
// After completion:
// {@ output.RunApprovalProcess.subworkflow.approvalStatus }   → "approved"
// {@ output.RunApprovalProcess.subworkflow.approvedByEmail }  → "director@company.com"
// {@ output.RunApprovalProcess.subworkflow.approvalComments } → "Approved for Q2 budget"
Outcome: The parent PO workflow continues once the approval child completes, reading the decision from subworkflow.approvalStatus. A Switch node branches on approved vs. rejected.

Example 2 — Shared Notification Dispatcher

A "SendNotification" child workflow handles the logic of routing to email, Slack, or SMS based on user preferences. Any parent workflow can call it with a recipient and message.

{
  "node_type": "SubWorkflow",
  "name": "NotifyCustomer",
  "config": {
    "sub_workflow_id": "notification-workflow-guid",
    "sub_workflow_version_id": 1,
    "input_data": {
      "recipientId": "{@ var.customerId }",
      "subject":     "Your order has shipped",
      "body":        "{@ var.shipmentEmailBody }",
      "channels":    ["email", "sms"]
    }
  }
}
Outcome: The child handles channel routing, retry logic, and delivery tracking. The parent simply calls it and moves on — no duplicate notification code in any parent workflow.

Example 3 — Common Data Validation Routine

A validation child workflow checks that a contact object has a valid email format, non-empty name, and a valid UK postcode. Any workflow handling user-submitted data can invoke it before processing.

{
  "node_type": "SubWorkflow",
  "name": "ValidateContactData",
  "config": {
    "sub_workflow_id": "contact-validation-workflow-guid",
    "input_data": {
      "contact": "{@ $input.current.contactData }"
    }
  }
}
// subworkflow.isValid       → true / false
// subworkflow.errors        → [ "Invalid email format", "Postcode required" ]
// subworkflow.validatedAt   → "2026-05-23T10:34:12Z"
Outcome: If subworkflow.isValid is false, the parent's Switch node routes to the error-handling branch that returns a validation error response to the caller.

Example 4 — Modular Invoice Generation

Invoice generation is complex: calculate line items, apply discounts, generate a PDF, upload to storage, and record in the ERP. Extract this into a child workflow and call it from both the order completion and subscription renewal parent workflows.

{
  "node_type": "SubWorkflow",
  "name": "GenerateInvoice",
  "config": {
    "sub_workflow_id": "invoice-generation-workflow-guid",
    "sub_workflow_version_id": 5,
    "input_data": {
      "orderId":    "{@ var.orderId }",
      "lineItems":  "{@ var.lineItems }",
      "customerId": "{@ var.customerId }"
    }
  }
}
// subworkflow.invoiceNumber → "INV-20260523-0042"
// subworkflow.pdfUrl        → "https://storage.../INV-20260523-0042.pdf"
// subworkflow.erpRecordId   → "ERP-99887766"
Outcome: Both parent workflows receive the same invoiceNumber, pdfUrl, and erpRecordId from the child, ensuring consistent invoice generation across the business.

Example 5 — Customer Enrichment from Multiple Sources

An enrichment child workflow calls three external APIs (credit bureau, company registry, social media) and returns a unified enriched customer profile. Any parent workflow needing enriched customer data calls it once.

{
  "node_type": "SubWorkflow",
  "name": "EnrichCustomerProfile",
  "config": {
    "sub_workflow_id": "customer-enrichment-workflow-guid",
    "input_data": {
      "customerId": "{@ var.customerId }",
      "email":      "{@ var.customerEmail }"
    }
  }
}
// subworkflow.creditScore      → 720
// subworkflow.companySize      → "SME"
// subworkflow.linkedInProfile  → "https://linkedin.com/..."
// subworkflow.enrichedAt       → "2026-05-23T10:34:00Z"
Outcome: The parent workflow accesses a complete enriched profile from a single Sub-Workflow call, regardless of the three underlying API calls the child performed.