0

In my flow I have created a String Collection Variable which I am using to store Email Addresses. I am passing the Email Address List to a custom Apex component, Send Better.
If the Email List is empty Send Better throws an error (understandably).
I have added a Decision to skip if the Email Address List is Null, but this is not working - even when the List String is empty the Decision still sees it as not Null
I also tried to use an Assignment to count the Collection, but this always outputted 1.
As it is a Collection I cannot use it in a Flow formula. I guess I could create an Apex Class to handle this, but I was hoping to avoid that.

Any and all creative solutions are appreciated.

enter image description here

3
  • Define another collection resource of the same type and leave it empty then compare the two to see if the emails collection is empty.
    – Phil W
    May 24, 2023 at 21:10
  • What is the logic you're using in the assignment that you've mentioned? I've used assignments to complete null checks like this in flow before. May 24, 2023 at 23:37
  • Please elaborate on how this collection is set. If I create a new Flow and all I include are a Text Collection variable and a Decision element that checks email_Addresses Is Null False, and I do not assign anything to the collection, when I debug the flow it works as expected. Are you calling an Apex Action earlier that returns a List and assigns it to your collection? If so it is likely assigning an empty List - which is not null. You might want to A) change your Apex to return null rather than an empty List, or B) do something like email_Addresses Contains @ rather than null check.
    – Moonpie
    May 25, 2023 at 0:04

1 Answer 1

0

Thanks for all the feedback! Further up in the flow I was removing a value from the List String. This resulted in the List String value being '[]' instead of null.
I adjusted the so I did not have to use the value and the decision now works.

1
  • Should I change the subject on this so others know it was an error in the config? May 26, 2023 at 14:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .