Remove empty collections

I am trying to automate sending an email to multiple recipients, but the number of recipient isn’t always the same. The format needs to be: One array containing multiple collections. Each collection contains the email of one recipients.

I was able to get my emails into this format, but the issue is that if recipients #5 doesn’t exist, it still creates a collection (that is empty). How can I remove empty collections from the array?

Hi. Maybe you can try create a json with the array result, remove the collection empty using replace function and parsing the json again before send the emails. It’s a guess. I do not see your array but I thing this approach can works

Thanks, Helio!
If you have questions reach out :wink:

1 Like

Hi @olivierbourdeau

Can you take a camera-viewfinder-duotone screenshot of your make scenario for me, along with the relevant module configurations and share-all-duotoneshare the images here?

Yes after many tries this is what I ended up doing and it worked, thanks!

1 Like