Removing null value from collection

I managed to add a null value to a text collection, and found a way to remove it.

How did I end up with this mess?
I have a loop that splits a comma separated string, and adds each item to a text collection. This string is normally a bunch of external IDs, but I ended up with

Result{!vaCSTextToSplit} = "70140000000cokEAAQ,, master_AshokaUpdates,news_USA,"

see that extra comma in there before ‘master’ - when that ran through the split-o-matic it created a collection that had a null / blank value in it. i use blank/null intentionally here, as i really was not sure which one it was.

{!collCampaignIDs} = "[70140000000cokEAAQ,,master_AshokaUpdates,news_USA,MASTER]"

and that was causing some (silent) havoc downstream when we looped over the collection to get a campaign record filtering against that external ID. the flow would pull a random campaign that had a blank external ID, since it was filtering on a field that was blank/null.

I updated the filter on the get records to filter out any blanks, using isnull equals false,but i also needed to remove the blank/null element from the collection.

How did I fix it?
I tried to use the removeall operator in an assigment to remove globalconstant.emptystring from the collection

no change - the collection remained the same.

ASSIGNMENT: asstEndOfLoop
{!collCampaignIDs} Remove All
Result
{!collCampaignIDs} = "[70140000000cokEAAQ,,master_AshokaUpdates,news_USA]"

So it must not be an empty string, must actually be null. But there is no option in the assignment element to remove a null value. So, I created a text constant, and did not give it any value.

conNull.png

And removed that constant in the assignment

ASSIGNMENT: asstEndOfLoop
{!collCampaignIDs} Remove All {!conNull}
Result
{!collCampaignIDs} = "[70140000000cokEAAQ,master_AshokaUpdates,news_USA]"

And that appears to have removed the null element! See the result above! No extra comma!

The ‘code snippets’ above are from the flow debugger, formatted automatically by this blog-o-matic thing I use.

 
1
Kudos
 
1
Kudos

Now read this

Determining which fields are used in a page layout (in less time than it takes to brew a cup of coffee)

There is a great app called FieldTrip that will let you know which fields are actually populated in records, but deep diving into eclipse, or using brute force, have been the only way that I am aware of to see which ones are actually... Continue →