Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Triggers
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Resources
  • Get help with 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.

7 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

Leave a Reply Cancel reply

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

Do you know what to do, but not how to do it?

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


NEW! Master the HTTP requests to SharePoint with a new cheat sheet!

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.

Hello and welcome!

My name is Tom and I'm a business process automation consultant and Microsoft MVP living in the Czech Republic. I’ve been working with Microsoft technologies for almost 10 years, currently using mainly Power Automate, SharePoint, Teams, and the other M365 tools.

I believe that everyone can automate part of their work with the Power Automate platform. You can achieve a lot by "clicking" the flows in the designer, but you can achieve much more if you add a bit of coding knowledge. And that's what this blog is about.

To make the step from no-code Power Automate flows to low-code flows: using basic coding knowledge to build more complex yet more efficient flows to automate more of your daily tasks.

  • Use Power Automate to forward Outlook events upon registrationJanuary 29, 2023
  • Why the condition is false for the same numbers (Power Automate)January 25, 2023
  • How to forward event invitation to other calendar (Power Automate)January 22, 2023
  • Run ‘For selected item’ flow from non-default environment (Power Automate)January 18, 2023
  • Hide button in SharePoint list after Power Automate flow startedJanuary 15, 2023

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2023 Let's POWER Automate | Theme by SuperbThemes