# How to trigger and run sub workflow in parallel?

**URL:** <https://community.n8n.io/t/how-to-trigger-and-run-sub-workflow-in-parallel/31690>\
**Category:** Questions\
**Tags:** execute-workflow\
**Created:** [October 17, 2023, 9:14am UTC](https://community.n8n.io/t/how-to-trigger-and-run-sub-workflow-in-parallel/31690 "2023-10-17T09:14:56Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![marvinwu](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@marvinwu](https://community.n8n.io/u/marvinwu)\
**Post date:** [October 17, 2023, 9:14am UTC](https://community.n8n.io/t/how-to-trigger-and-run-sub-workflow-in-parallel/31690/1 "2023-10-17T09:14:56Z")

</div>

## Describe the problem/error/question

I am trying to trigger workflow make it run parallel, I have setup a following dummy setup.

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/e/3/e3ad1fa067603e77ea5c541a6f15403992c631f8.png)

what I expecting is starting the workflow, it will run workflow 1 and workflow 2 in parallel.  
but now it runs in sequential order, ie. run workflow 1 → workflow 2, which is kind of unexpected. what am I missing ?

## What is the error message (if any)?

## Please share your workflow

## Share the output returned by the last node

## Information on your n8n setup

- \*\*n8n version: 1.8.2
- \*\*Database (default: SQLite):SQLite
- **n8n EXECUTIONS\_PROCESS setting (default: own, main):**
- \*\*Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
- **Operating system:**

---

<div class="post-metadata">

**Author:** ![marvinwu](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@marvinwu](https://community.n8n.io/u/marvinwu)\
**Post date:** [October 17, 2023, 9:16am UTC](https://community.n8n.io/t/how-to-trigger-and-run-sub-workflow-in-parallel/31690/2 "2023-10-17T09:16:08Z")

</div>

the sub workflow is very simple, just a trigger and a simple echo “hello”

---

<div class="post-metadata">

**Author:** ![EmeraldHerald](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/emeraldherald/32/35355_2.png) [@EmeraldHerald](https://community.n8n.io/u/EmeraldHerald)\
**Post date:** [October 17, 2023, 3:11pm UTC](https://community.n8n.io/t/how-to-trigger-and-run-sub-workflow-in-parallel/31690/3 "2023-10-17T15:11:26Z")

</div>

Hi @marvinwu 👋

The quick answer to this would be that workflows, at the moment, only execute nodes in sequence - they won’t execute in parallel. In your example, “Execute Workflow 2” will only run once “Execute Workflow 1” finishes.

A workaround for this is to have those sub-workflows triggered by Webhook nodes (set to respond immediately). From the main workflow, you’d execute the sub-workflows using the HTTP node, and then you can trigger the execution of several sub-workflows in parallel 🎉

---

<div class="post-metadata">

**Author:** ![marvinwu](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@marvinwu](https://community.n8n.io/u/marvinwu)\
**Post date:** [October 18, 2023, 8:03am UTC](https://community.n8n.io/t/how-to-trigger-and-run-sub-workflow-in-parallel/31690/4 "2023-10-18T08:03:57Z")

</div>

Thanks much @EmeraldHerald , the webhook solution works!

---

<div class="post-metadata">

**Author:** ![shrey-42](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/shrey-42/32/3437_2.png) [@shrey-42](https://community.n8n.io/u/shrey-42)\
**Post date:** [October 18, 2023, 8:47am UTC](https://community.n8n.io/t/how-to-trigger-and-run-sub-workflow-in-parallel/31690/5 "2023-10-18T08:47:49Z")

</div>

@EmeraldHerald  
Could it be possible to trigger subworkflows from within a Code node?

Why: because, i’m primarily wanting to execute a batch of subworkflows in a `Promise.all()` manner.

Currently, the only 2 options seem to be:

- Execute subworkflows sequentially (trigger the next one when the last one is over)
- Use the Webhook approach to execute a batch of subworkflows (but now, if i want to execute the next batch, i’ll need to have an ad-hoc Wait node [which causes further, other issues as well], or trigger all the possible executions at once, which is usually not feasible )

Hence, i’m trying to figure out a way to trigger a batch of (subworkflow) executions, say 10 at a time, and then wait for all of them to finish before triggering the next batch.

---

<div class="post-metadata">

**Author:** ![marvinwu](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@marvinwu](https://community.n8n.io/u/marvinwu)\
**Post date:** [October 18, 2023, 8:59am UTC](https://community.n8n.io/t/how-to-trigger-and-run-sub-workflow-in-parallel/31690/6 "2023-10-18T08:59:56Z")

</div>

agreed, I think thats a pretty common way of composing workflows:

workflow 1 |  
workflow 2 | --( wait for all finish ) → workflow 4  
workflow 3 |

---

<div class="post-metadata">

**Author:** ![EmeraldHerald](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/emeraldherald/32/35355_2.png) [@EmeraldHerald](https://community.n8n.io/u/EmeraldHerald)\
**Post date:** [October 19, 2023, 8:39am UTC](https://community.n8n.io/t/how-to-trigger-and-run-sub-workflow-in-parallel/31690/7 "2023-10-19T08:39:34Z")

</div>

Hi @shrey-42 👋 While you can’t trigger workflows with a code node, it sounds like maybe something like Hookdeck could help you with the webhook trigger timing? 🙇‍♂️

---

<div class="post-metadata">

**Author:** ![BramKn](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/bramkn/32/11894_2.png) [@BramKn](https://community.n8n.io/u/BramKn)\
**Post date:** [October 19, 2023, 8:51am UTC](https://community.n8n.io/t/how-to-trigger-and-run-sub-workflow-in-parallel/31690/8 "2023-10-19T08:51:17Z")

</div>

I have tried to add an option to a custom node to allow it to not wait for the sub workflow before continueing in the main flow.  
Sadly wasn’t able to. Maybe it is possible but we would need the help of someone that understands the core of n8n. 🙂

---

<div class="post-metadata">

**Author:** ![shrey-42](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/shrey-42/32/3437_2.png) [@shrey-42](https://community.n8n.io/u/shrey-42)\
**Post date:** [October 19, 2023, 9:23am UTC](https://community.n8n.io/t/how-to-trigger-and-run-sub-workflow-in-parallel/31690/9 "2023-10-19T09:23:19Z")

</div>

Hey @EmeraldHerald, if i’m not wrong, Hookdeck (similar to Convoy, which i already use) is an external tool (can’t be operated natively within n8n). In that case, this would really not be an ideal solution to have to manage subworkflow executions using another external tool. (Note: we are already employing 1 level of workaround by using `Webhook`/`HTTP` instead of `Execute Workflow` node).

Also, i think, the problem would still remain wherein the status of the completion of the entire batch ( `Promise.all()` ) of currently executing subworkflows would be required to be saved & retrieved somehow.

PS: for now, i resort to breaking down the ‘chain-of-workflows’ into ‘async subworkflows’, and use a datastore to manage their status/triggers.

---

<div class="post-metadata">

**Author:** ![BramKn](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/bramkn/32/11894_2.png) [@BramKn](https://community.n8n.io/u/BramKn)\
**Post date:** [October 19, 2023, 10:05am UTC](https://community.n8n.io/t/how-to-trigger-and-run-sub-workflow-in-parallel/31690/10 "2023-10-19T10:05:19Z")

</div>

Using rabbitMQ is also a good way to get things going in parallel.  
Simply use a workflow that gets it from the rabbitMQ queue and make it start a workflow that was stored in the queue entry body. 🙂  
So → insert workflow Id to run with data you need into rabbitMQ  
Trigger with RabbitMQ trigger → Trigger the workflow that was stored and insert the data into it.  
RabbitMQ trigger can then be set to parallel executions of ur liking.  
Of course you do need to store it somewhere after it was completed so you can continue a main flow for example.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [October 26, 2023, 10:05am UTC](https://community.n8n.io/t/how-to-trigger-and-run-sub-workflow-in-parallel/31690/11 "2023-10-26T10:05:45Z")

</div>

Closed on October 26, 2023, 10:05am UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
