What are sub-workflows?
Sub-workflows are helper workflows called by parent workflows via n8n’s Execute Workflow node. They encapsulate reusable logic (PDF generation, data parsing, API calls) and are invisible to end users.Key rules
| Rule | Details |
|---|---|
| No Codika Init | Sub-workflows do not register their own execution |
| No Submit Result / Report Error | Data returns to parent via Execute Workflow |
| At least 1 input parameter | n8n requires this |
| Cost: 0 | Execution cost attributed to parent |
| Output schema: [] | Always empty |
| Start with Execute Workflow Trigger | Required entry point |
| SUBWKFL placeholder | Parent references sub-workflow by placeholder, not hardcoded ID |
config.ts definition
Sub-workflow entry
Parent workflow entry
The parent workflow lists the sub-workflow’sintegrationUids in its own integrationUids array (integration inheritance).
Sub-workflow JSON
Entry node (Execute Workflow Trigger)
Accessing input data
Parent workflow: calling the sub-workflow
Execute Workflow node
workflowIduses theSUBWKFLplaceholder with the sub-workflow’sworkflowTemplateIdwaitForSubWorkflow: truemakes the parent wait for the sub-workflow to completeexecutionIdandexecutionSecretare forwarded from Codika Init for platform tracking
Passing execution metadata
If the sub-workflow uses Codika Upload File, it needs the parent’s execution metadata:Parent sends metadata
Sub-workflow uses metadata in Upload File
SUBWKFL placeholder format
workflowTemplateId in the placeholder must exactly match the workflowTemplateId in the config.
Examples:
{{SUBWKFL_text-processor_LFKWBUS}}{{SUBWKFL_pdf-generator_LFKWBUS}}{{SUBWKFL_email-parser_LFKWBUS}}
Deployment order
Sub-workflows are deployed before parent workflows automatically. The platform resolves the dependency graph and deploys in the correct order. No manual ordering is needed.Validation
The CLI checks sub-workflow patterns:| Rule | What it checks |
|---|---|
UC-SUBWORKFLOW-REFS | SUBWKFL placeholders reference valid workflows |
CK-SUBWORKFLOW-PARAMS | Sub-workflows have at least 1 input parameter |
UC-CALLEDBY | calledBy arrays are consistent |