Loopfour
WorkflowsSteps

Reuse one workflow inside another

Call a shared workflow as one step of another, so a task you repeat in many workflows, such as creating a customer, is built only once.

Some tasks appear in many workflows, such as setting up a new customer or posting a journal entry. Build that task once as its own workflow. Other workflows then run it as a single step, called a sub-workflow.

  1. TriggerDeal closes
  2. StepSub-Workflow: set up the customer
    Runs your shared "New customer" workflow.
  3. OutputInvoice created
    Uses the customer the shared workflow made.

When you change the shared workflow, every workflow that calls it uses the change from its next run.

Before you start

  • Build the shared workflow and Deploy it. A sub-workflow step can run only a workflow that is Active.
  • Know what the shared workflow needs to be given, such as the customer's name and email.

Add a sub-workflow step

Add the Sub-Workflow block

Drag Sub-Workflow from Core Blocks onto the canvas.

Choose the workflow

Under Workflow, pick the shared workflow.

Pass it what it needs

Input Mapping passes values from this workflow to the shared one, such as the customer name from the deal. Ask chat to fill it in, for example "pass the deal's company name and contact email to the New customer workflow".

Choose whether to wait

With Wait for Completion on, this workflow waits for the shared one to finish and can use its results. Timeout (minutes) sets how long to wait; it starts at 5 minutes. Turn it off when nothing later depends on the result.

Good to know

  • The shared workflow gets its own run under Runs, so you can read it on its own.
  • With Wait for Completion on, a failure in the shared workflow also fails the calling step. With it off, the calling step does not wait to learn the outcome.
  • If the shared workflow takes longer than Timeout (minutes), the calling step fails, but the shared run keeps going.
  • Leave the other settings, such as Idempotency Key and Queue Name, to your developer.

Check it worked

Run the calling workflow. Under Runs, you see a run for it and a run for the shared workflow.

If something goes wrong

If the shared workflow will not start, check that it is Active and has the needed input. If it fails or times out, inspect its own run before retrying the parent. See Fix and retry a failed run.

On this page