Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Triggers
  • Resources
  • ABOUT ME
  • Get help with your flow
Menu

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

Posted on October 14, 2020January 6, 2022 by Tom

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

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 resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

10 thoughts on “What value to use in condition ‘if field is empty’ in Power Automate”

  1. Popkornak says:
    May 26, 2021 at 4:53 pm

    For MultipleChoices / empty arrays you can use empty() function:
    empty(-contenthere-) = true

    Reply
  2. Angel says:
    April 13, 2022 at 5:09 pm

    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

    Reply
    1. Tom says:
      April 23, 2022 at 8:21 pm

      Hello Angel,
      the article describes multiple types of columns and the value you should use, maybe they’re multiple selection columns.

      Reply
  3. Judy says:
    September 21, 2022 at 4:36 am

    Thank you for your post.
    You solved my problem.
    : )

    Reply
  4. Ciktor says:
    September 26, 2022 at 5:47 pm

    Thank you

    Reply
  5. Reg Ferreira says:
    November 2, 2022 at 5:12 pm

    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

    Reply
    1. Tom says:
      November 13, 2022 at 6:26 pm

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

      Reply
  6. MD says:
    March 16, 2023 at 10:20 pm

    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

    Reply
  7. CL says:
    April 26, 2023 at 6:50 am

    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.

    Reply
    1. CL says:
      April 26, 2023 at 6:55 am

      Using the length(content) greater than 0 worked

      Reply

Leave a Reply Cancel reply

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

Working on an APPROVAL PROCESS? You might like the Approval flow template I just released!


...or looking for something to help you translate thoughts into flows?

Get The Ultimate Power Automate expressions cheat sheet and translate your thoughts into flows with ease!


There's also the HTTP requests to SharePoint cheat sheet to help you overcome limitations of some standard actions!

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 resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with thousands of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2023 Let's POWER Automate | Theme by SuperbThemes