cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DaveBrom
Level: Powered On

Flow Condition If Field is Blank

Hi All,

 

I'm trying to pull records from Salesforce (trigger when record modified) and add them to a SharePoint list. In general, this works, but I also need to check to see if the record has previously been added to the list and Update it if already exists. 

 

So when the Salesforce trigger runs, I use Get Items to get the records on the SP list. Since the record may or may not exist on the SP list, I use a filter query to compare the Salesforce AccountID field of items on the SP list to the current record being modified. I then use a Condition to check to see if the AccountID field from the Get Items comes back empty (no match).  

 

This works as long as there is an existing record on the SP list that matches up. Then the Condition goes down the No branch (AccountID is not empty) and the Update part works fine. But if the record doesn't already exist on the SP list, now then the output of the Get Items is empty, but the Condition still chooses the No branch. 

 

I've tried setting the Condition to check for null and I've also tried checking for "empty" using each of the following expressions:

 

@equals(items('Apply_to_each')?['SF_x0020_Account_x0020_ID'], null)

@empty(items('Apply_to_each')?['SF_x0020_Account_x0020_ID'])

 

Neither one seems to work. Any suggestions?

 

Here's a screen shot of the flow as it is now:

MSFlow check blank.png

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Flow Condition If Field is Blank

Hi @DaveBrom,

 

Could you please share a screenshot of the configuration of your flow?

 

I have made a test on my side and don't have the issue that you mentioned.

The screenshot of my flow as below:

Capture.PNG

 

If the output of the Get Items is empty,the flow would run successfully to the If yes branch as below:

Capture.PNG

 

Best regards,

Alice

 

 

Best regards,

Alice

View solution in original post

9 REPLIES 9
Microsoft Employee

Re: Flow Condition If Field is Blank

For the Condition try to the following:

  1. Add a Compose before condition and add in the field you want to look at.
  2. Add another Compose and added express of empty() + compose above you created.
  3. In the Condition now add the output of the 2nd Compose and right side true.
  4. Now move your Create / Update to the correct side.
  5. From the screenshot below they should people be flipped if using all information above.

2019-01-03_13-59-19.jpg

Community Support Team
Community Support Team

Re: Flow Condition If Field is Blank

Hi @DaveBrom,

 

Please refer to screenshot below to create the flow:

Capture.PNG

 

The expression in the Condition as below:

@empty(body('Get_items')?['value'])

 

Best regards,

Alice

DaveBrom
Level: Powered On

Re: Flow Condition If Field is Blank

I gave this a try, but it still just wants to always go down the one side (the No side). It never seems to recognize it as being empty (or 'true') and going down the Yes side.
DaveBrom
Level: Powered On

Re: Flow Condition If Field is Blank

Thanks for the response. I gave this a try as well and I'm still not getting it to go down the Yes branch - everything just wants to go down the No branch whether it's empty or not.
Highlighted
DaveBrom
Level: Powered On

Re: Flow Condition If Field is Blank

Thanks for the response. When I try this, it doesn't complain about any failure, but it also doesn't execute the Condition successfully if the field is empty. It just seems to stop there without doing anything else. If there is data in the field, then it works fine on the No side. I just can't get it to go down the Yes side.
Community Support Team
Community Support Team

Re: Flow Condition If Field is Blank

Hi @DaveBrom,

 

Could you please share a screenshot of the configuration of your flow?

 

I have made a test on my side and don't have the issue that you mentioned.

The screenshot of my flow as below:

Capture.PNG

 

If the output of the Get Items is empty,the flow would run successfully to the If yes branch as below:

Capture.PNG

 

Best regards,

Alice

 

 

Best regards,

Alice

View solution in original post

MikeyB03
Level: Powered On

Re: Flow Condition If Field is Blank

Hi @v-yuazh-msft,

 

I have the exact same problem as @DaveBrom but am using the new version of the advanced condition builder. I just cannot get the flow to return true when my array is empty. I just keep getting 'Not Specified'. I can't work out what i'm missing here.

 

Please see my screenshots below for details.

 

Thanks for your help,

 

Mike

 

Expression

Expression.jpg

Get Items.jpg

 

Not Evaluating.jpg

MikeyB03
Level: Powered On

Re: Flow Condition If Field is Blank

I just realised I have an extraneous apply to each in there that was causing the problem.

 

All good now!

DaveBrom
Level: Powered On

Re: Flow Condition If Field is Blank

Hi @MikeyB03 

 

If you're still looking for an answer on this, the issue is that your expression statement isn't referencing the right objects. You have the expression as:

 

empty(body('Get_Items')?(['value'])

 

which is saying that you're looking for the value the Get Items action, but that's not accurate. What you're really looking for, in your case, is the value in the Apply to Each 2 action which has the list of values/items from the Get Items action. So your expression should be like this:

 

empty(items('Apply_to_each_2')?(['value'])

 

Hope this helps.

Dave

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 86 members 5,025 guests
Recent signins:
Please welcome our newest community members: