Is the sub workflow can be waiting return specific result in parent workflow

Can I just active the workflow1 in this workflow, and don’t go to the next node(Merge) until the workflow1 returns specific results.In this case, the flow will go ahead when workflow1 execute.

Should I create a custom node which can achieve my demand in the workflow1 instead of using workflow to do this?

Hi @vanessa, welcome to the community!

So just to make sure I understand your problem correctly, you’d only want to continue with your workflow execution if your Execute Workflow1 node returns one or more items meeting certain criteria?

If so, I’d just add an IF node after the Execute Workflow1 node checking the result. If it doesn’t meet your conditions, you throw an error and preventing the workflow from finishing using the Stop And Error node. This is how it could look like:

When checking multiple items at once, make sure your IF node only runs once (under Settings). I have built a quick demo which you can paste into your own n8n canvas to try out (you’d need to adjust the IDs for each Execute Workflow node though). My IF node checks if exactly three items have been returned by the previous Execute Workflow node. You can, of course, build your own Expression to verify your success condition.

Example Workflow
1 Like

Thanks MutedJam so much. Maybe I can’t describe clearly, I am sorry for that. The Execute Workflow1 node contain a trigger condition in it, maybe a cron or a web hook. If I start the workflow, The Execute Workflow1 node can be actived, and until it finish its flows in itself and throw the result , the next node (eg, the Merge node in the picture) will no go ahead.

Oh, I am not sure I fully understand this case. To clarify, the workflow executed by the Execute Workflow node will not start at a trigger node but at its Start node.

So whenever the workflow from your initial screenshot runs, it would launch the workflow referenced in Execute Workflow1 which would then run whatever is connected to its Start node rather than waiting for any triggers.

If you need to make sure that your Execute Workflow1 node finishes before anything else runs, you could build your workflow sequentially rather than having parallel branches:

In this example, Execute Workflow 1 runs first and only once it has finished it would run Execute Workflow 2.

As before you could put IF nodes in between to determine whether the execution should continue or not as needed:

Thanks for your time . So, how should I handle asynchronous event in my flow with having parallel branches?

One possibility would be to utilize a database in which different workflows controlled through different triggers can store their data.

You could then have a separate workflow regularly polling the data and only continuing when all required data is available.

Thanks MutedJam.
I tried to solve my demand which is want to handle asynchronous event in workflow with using wait node , but seems fail. The wait node will pause the whole workflow and prevent the node which is the the same position with it in other branch.


As the workflow that I want to mock asynchronous event being created in the picture, when the workflow start, send email1set nodes、will be executed,but send email2 will be stoped, because there is a wait node is executed.
So, Is there no solution to achieve that send email2 not be paused no matter the wait node is other
branch is executed? If I want send email3 and send email4 be executed in some condition and don’t influence send email2, the way to solve this is use database which like your reply above?

Parallelization within a single workflow isn’t something n8n handles at the moment I am afraid, see for example Is there a way to make workflow nodes run in priority or in parallel? - #2 by jan.