What value to use in condition ‘if field is empty’ in Power Automate

“The Power Automate condition ‘if field is empty’ always returns false, no matter what.”

“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.

Power Automate condition: field is empty

On the other hand, to check if field in SharePoint item is empty, you must use ‘null’ expression.

Power Automate condition: field is empty 2

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'])
Power Automate condition: field is empty 4

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.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to a special content like a SharePoint Filter Query cheat sheet.

Zero spam, unsubscribe anytime.

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *