GoRunner docs
Search or askSearch⌘K

Run another workflow

Call one workflow from another as a step, and use what it returns.

4 min · Cloud, Self-hosted and Embed

Build a job once, such as “look up the customer”, and call it from every workflow that needs it.

TriggerNew orderWebhook
01Look up the customerSub-flow
02Email the customerGmail

Look up the customer runs another workflow, waits for it, and passes its result to step 02.

Set up the workflow you call

  1. In the workflow to call, press Add a trigger and choose When Called by Another Workflow.
  2. In Expected Input, write a sample of what it receives, such as {"email": "ada@acme.example"}.
  3. In its steps, use the input as {{trigger.email}}.
  4. Press Publish.

The sample is the agreement between the two workflows: the calling step fills its Input from it, and a test of this workflow uses it.

Call it

  1. In the other workflow, add a step: type sub-flow and choose Sub-flow.
  2. Under Workflow, choose the one to call.
  3. In Input, put in your values, such as {"email": "{{trigger.body.email}}"}.

Later steps read what it returned: {{steps.step_1.output}} is its last step’s output, and {{steps.step_1.steps}} holds every step’s.

What to know

It waits
The step waits until the other workflow ends. There is no option to carry on without waiting.
Its version
It runs the published version of the workflow you call, or its draft if it was never published.
If it fails
The step fails too, with the reason, and the step’s On error decides what happens next.
Its own run
On a run’s page, the step’s Output names the workflow it ran and shows what came back. Open that run shows every step inside it.
Time
It must finish within both workflows’ time limits.
Depth
Workflows can call each other 5 levels deep. A workflow that calls itself stops there.

Note In a workflow you call, an approval fails, and a Delay longer than 5 minutes fails. Put waits in the calling workflow.

Check it worked

Press Test in the calling workflow. The Sub-flow card shows Worked, and its Result shows what came back.

For developers

The step is pieceId: "subflow", actionId: "execute", with config.workflow_id and config.input. The trigger is callable (called_by_flow). Its output also has subRunId, the id of the other workflow’s run. See Workflow definition.

Checked against 12d85b3b