"is null" operator unreliable in flow - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Jacob MarshallJacob Marshall 

"is null" operator unreliable in flow

I have a Flow which is called from Process Builder in my org.  Process builder passes an input_parentid value to my flow.  The first element in my flow is to check if input_parentid value is Null, which decides which path the flow will take:
User-added image
Please see the following log, where despite this field being blank, the outcome of the decision evaluates to true:
User-added image

input_parentid does not have a default value, and I know its Null because I'm creating it in an Apex unit test with the following statement:
    Territory__c terr = new Territory__c(Name = '010101 Seattle, WA', Territory_Id__c = '010101',Ownerid = usr.id);
      insert terr;

Does anyone have a good workaround for this issue?  I've found that if I set the variable to blank in a formula from process builder, I can compare to an emptystring in the flow.  This seems like a lot of extra work though.  Is there something I'm missing?  This issue didn't occur during manual testing, are there caveats with APEX unit tests and Process Builder/Flows?

Appreciate any assistance 
Best Answer chosen by Jacob Marshall
Jeff MayJeff May
Your post title says it all -- 'is null' is flaky in PB criteria.  Trying to get PB to behave when checking for things like 'is null' can be a losing battle. Instead, I create a formula checkbox field that has my criteria, then I test that checkbox in the PB criteria.

All Answers

Jeff MayJeff May
Your post title says it all -- 'is null' is flaky in PB criteria.  Trying to get PB to behave when checking for things like 'is null' can be a losing battle. Instead, I create a formula checkbox field that has my criteria, then I test that checkbox in the PB criteria.
This was selected as the best answer
Jacob MarshallJacob Marshall
Thanks Jeff!  Glad to know this isn't an unusual issue.