How to trigger after the last batch in Split In Batches

Hey everyone :waving_hand:

I’m using Loop Over Items (Split in Batches) to process contacts one by one from HubSpot,
and I’d like to trigger the next workflow only when the loop is fully done.

However, on the last iteration, the loop branch outputs nothing (no data),
so I can’t detect the “end of loop” event.

Is there a recommended pattern or node setup to detect that the loop is finished?

Hey @yoser !

Welcome.

You can use an “Aggregate” node , connect it directly to the Done branch and at the end of iteration should collect all the items.

1 Like

Try toggling on Always Output Data option from node settings. If you only need to track the end of loop, then even an empty item would be enough. Use an aggregate node just as @Parintele_Damaskin suggested afterwards.

1 Like

Hey @Parintele_Damaskin and @Mookie_Lian :waving_hand:

Thanks for your suggestions!
I actually found a simple way to detect when the loop (Split In Batches) is fully finished.

You can use an IF node right after the loop, and check this condition:

{{ $node["Split - Process_Contacts_One_by_One"].context["noItemsLeft"] }}

When this evaluates to true, it means there are no items left to process — so that’s your “end of loop” signal.

This worked perfectly for triggering the next workflow only once the loop is completely done. :rocket:

:clap:

Glad that you found a way that fits your requirements!