Trigger part 2 of workflow when splitbatches finishes

Hello! i want to trigger a part of my workflow everytime the splitbatches ends.

The top line of my workflow is an HTTP call , that receives a List off items i iterate over.

The second is the pagination of the next url i need to ping, once the previous list of items has been iterated over.
I tried in the IF2 node to put a statement of {{$node[“SplitInBatches”].context[“noItemsLeft”]}} trigger the HTTP to call a wait node webhook but i tested and the if statement true doesnt seem to be running once the splitbatch node is finished …
what if conditino should i put to run in the last iteration of the splititem batch ?
Also, how do i use the wait node with the option of the webhook in this case?
HEre is my workflow

Information on your n8n setup

  • n8n version: cloud
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]:

Hi @oly-dev, it seems the example workflow you have shared requires specific credentials to run, so I won’t be able to reproduce exactly how it behaves.

In general, you can use two separate Split in Batches loops like so:

One possible problem with your workflow could be that your IF2 node is checking for {{$node[“SplitInBatches”].context[“noItemsLeft”]}}, but it seems to be connected to SplitInBatches2 (with a trailing 2). Also, it seems to be using fancy quotes typically set by using text processors such as Microsoft Word. n8n like many other tools would however require quotes such as ' or ".

So your expression would probably have to be something like {{ $node["SplitInBatches2"].context["noItemsLeft"] }} instead.

Hope this helps!

1 Like

Hi @oly-dev

@MutedJam Gave you a nice example of how to do it.
There is also a community node that helps out especially if you want to combine the batches and use them later again as well.

1 Like

As much as I love that community node, these nodes aren’t available on n8n cloud yet

1 Like

oh whoops. Didnt realise he was on cloud.
I said nothing then :slight_smile:

thanks ! i ended up using this expression {{$node[“SplitInBatches”].context[“noItemsLeft”]}} ,

turned out it was a silly spelling mistake!

1 Like

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