Use multiple items to trigger seperate executions of another workflow

Use multiple items in one workflow to trigger seperate executions of another workflow.

I have a workflow that gathers some basic json data which is to be used to run another workflow. It’s possible that it will produce 0, 1 or more items of identically structured simple json.

My problem is that the second workflow uses a Wait Node, which works based on the execution number. As a result if I have more than 1 items then the Wait node is triggered when the first item produces a return, and the other items aren’t ready yet. I need to retain the Wait Node for each item, and so it seems the best thing would be to trigger multiple executions; one execution for each item.

Can anyone suggest an approach to complete this workflow so that it will trigger the second workflow once for each item instead once for all three items together?

This is my workflow

(I haven’t hooked it up to a timer yet, so for now it has a manual execution, but I’ll get to that)

The output returned by the MySQL node


As ever, with my thanks to you all, D

Hi @Dan_Ray, I am afraid n8n doesn’t currently handle Wait nodes in sub-workflows correctly (at least for wait times > 65 seconds).

We’re tracking this bug internally (as N8N-6883/PAY-80) but unfortunately I don’t know when exactly this problem will be resolved.

So my suggestion here would be to avoid sub-workflows in this very specific case and instead process your items in your parent workflow, for example like so:

This example will process one item at a time first (and once the aforementioned problem is fixed you could simply call the sub-workflow from within the loop as well).

Hope this helps, give me a shout if you’re still running into trouble here :slight_smile:

1 Like

Hi MJ,
Thanks for the reply and the suggestion. Sadly, I don’t think this approach is going to be possible, because I need to have each item run through the sub-workflow seperately so that each item has it’s own Wait node which can be triggered using it’s own workflow number in the $execution.resumeUrl.
This approach of using the Split in Batches will achieve the first goal of executing the subworkflow once for each item in the first workflow, but as long as the Wait node causes an error I’ve got a problem, and I’ve tested that and it does still cause an error.

Bringing the Wait node into the first workflow means I’m back to having multiple items per execution but only one Wait node per execution, whereas I need a seperate Wait node for each item, and therefore seperate executions for each item.

I’d love to hear more about when N8N-6883/PAY-80 will be addressed, as that sounds like it is really the key thing for me. Alternatively, if you have any other suggestions for a workaround then please do share them.

Many thanks, D

Could you not use a combination of HTTP Request and Webhook-Node to call the (sub-)workflow?

1 Like

Yes, I’ve implemented that instead and it works well.
I appreciate the input, thank-you!

1 Like

Glad to hear that it was helpful. Have fun!

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