How can I stop a scenario if no bundles are returned?

I’ve got the following scenario that searches for items in a Notion database, aggregates the output and sends it to a user via a Slack IM. It works really well except that when the initial module finds no bundles it still runs the rest of the scenario and sends the message in Slack.

I created a filter after the search to try and make it stop if there weren’t valid bundles but it proceeds anyway. How can I stop the scenario if the first module produces no bundles?

Hi @timjeffries ,

You need to add a filter after the Array Aggregrator, as regardless of whether you are getting data or not the aggregator will always output results thus continuing the scenario.

Add a filter in-between the Array Aggregator and Search for User Module, that will be if the array length is greater than 0.

Also, Not sure of the exact use case on why you are using Text Aggregrator, but add a filter in between text aggregator and array aggregator, checking if Text Aggregrator output is not Empty then proceed forward to Array Aggregrator.

1 Like

In the advanced settings of Text aggregator and Array aggregator, you can tick “Stop processing after an empty aggregation”.

2 Likes

Thank you @Runcorn and @Fasil

This is perfect!

1 Like