“”The Power Automate condition ‘if field is empty’ always returns false, no matter what, what am I doing wrong?”
“What value should I put on the right side of the condition?”
As Power Automate connects to multiple sources, there is no standard what the condition ‘if field is empty’ should look like. There’re different values for different situations. For example, when you’re using the condition to check data from MS Forms, you compare the value to ‘blank’. That means you leave the right side empty.
On the other hand, to check if field in SharePoint item is empty, you must use ‘null’ expression.
But that works only if it’s not an Array field, e.g. People picker with multiple selections enabled. In that case you’ll need an expression to check if the array is empty. My preference goes to the length(…) expression to check the length of the array (number of items in it) as used to check if file or item exists. If it’s greater than 0, the array is not empty. If it’s 0, then it’s empty.
length([DynamicContent])
e.g.
length(outputs('Get_item')?['body/PersonToUpdate'])
OR you can use the empty(…) expression as mentioned by Popkornak in the comments. If empty(…) is equal to true, the array is empty. If it’s equal to false, it’s not empty. The true/false value on the right side is also an expression.
empty([DynamicContent])
e.g.
empty(outputs('Get_items')?['body/value'])
As you can see, such a simple condition ‘if field is empty’ is not that simple after all. Is there a way to get the right ’empty’ value without ‘try and see’?
Get the right ’empty’ value
The solution is to check the item itself in the flow history, to see what data it works with. Expand the action where you get the item / response / other data, and find your field. Let’s take the action ‘Get response details’ from MS Forms. The ‘Rating score’ field is in the Outputs, and it’s empty. The proper ’empty’ value for the condition is to leave the field empty.
Now let’s check the ‘Get Item’ from SharePoint action. Here you can see, that the ‘Person_MultipleSelection’ has value [] – an empty array. As already mentioned above, you’ll need an empty array variable for the comparison. You could try to put [] on the left side of the condition, but Power Automate won’t allow you to do that.
The last situation, when you need to use the ‘null’ expression, is when you don’t find the field in the history. Some actions just skip the empty fields, it’s null.
Summary
As you can see, even thought there’re multiple options, you don’t have to try all of them. By checking the flow run history you can see what data it contains. And once you know what to expect it’s easy to set up the ‘if field is empty’ condition accordingly.
In the end it’s a similar process as when debugging any other condition.
For MultipleChoices / empty arrays you can use empty() function:
empty(-contenthere-) = true
to check blank value for multiple columns of SharePoint “null” expression not working, every time condition is true but there are blank columns in SharePoint. Pls guide
Hello Angel,
the article describes multiple types of columns and the value you should use, maybe they’re multiple selection columns.
Thank you for your post.
You solved my problem.
: )
Thank you
Hi Tom,
I’ve tried so many ways to solve for the null issue, I just don’t know where to go next. Unfortunately sometimes you don’t see the data because of some nasty flow error message as you can see here where I reached out to power automate community…
https://powerusers.microsoft.com/t5/Building-Flows/Dealing-with-NULL-s-in-Power-Automate-using-coalesce-function/td-p/1851508
Hello Reg,
if you don’t see the value then it’s often “try and see” approach. Sometimes helps to add some ‘Compose’ action with only the value and see the ‘raw output’.
I’m glad you are born, Who knew one day you would solve my problem i have dealt for days and i am able to sleep tonight. thanks
Has anyone checked if Azure DevOps queries return nothing? If so, what would that look like? I’ve tried a few ways now and none of them seem to be working.
Using the length(content) greater than 0 worked
Can you also add “if field is empty” in “List rows present in a table” in Power Automate to address the same concern with Excel Spreadsheets?
Thank you in advance!
Hello David,
take a look on this article, it might be what you’re looking for. It’s not a ‘Condition’, but it explains how to filter such rows directly: https://tomriha.com/skip-empty-rows-when-processing-excel-file-in-power-automate/