cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
JonnyMain
New Member

IF condition returns false when true expected

First time poster and a newcomer to Power Automate but come from a programming background.

 

I'm building a flow to validate and update information in a Sharepoint list - it's for logging and tracking the progress of Asset Purchase Requests but that's largely irrelevant.  Inside the flow is a condition check to make sure all the information needed to advance the status to Requisitioned is present.  If this fails a string of errors is built up to provide the reasons for failure to the user in an email.  The check on the supplier variable is returning a false when it should be true.  My diagnosis is as follows:

 

1. Supplier variable initialised:

Supp var.png

 
 

This is set further on in the flow after Get Item retrieves the Sharepoint List item the flow is running on and an optional input at the beginning of the Flow using Input boxes in the triggering event (For a Selected Item)

Set Supplier.png

 

It is possible for the supplier to be left empty although this causes the validation on the item to fail (legitimately) here:

Validation.png

 

A variable storing all the possible errors is appended to in order to provide feedback to the user about the reasons for the flow failing. In the following, a check on the Supplier variable is made (NB: In this example the Cost price is also 0 so it fails for multiple reasons):

Supp Check.png

However, when I run the flow despite the Supplier variable being set to Null (here we can see it being set by the flow.)

RunSet Supp.png

When the check is made to fill the error message it doesn’t recognise the variable as being set to null and therefore doesn’t populate the error message string variable.

Error Supp.png

The Supplier variable is empty yet the IF supplier = null condition returns false. Help! What am I missing here?

 

1 ACCEPTED SOLUTION

Accepted Solutions
JonnyMain
New Member

Re: IF condition returns false when true expected

Update on this:  I found a workaround.

 

Instead of checking the value of the variable I can write an expression using the empty() function

SolutionSupp.png

So the above expression reads as:

empty(variables('Supplier')) is equal to true.

 

 

View solution in original post

1 REPLY 1
JonnyMain
New Member

Re: IF condition returns false when true expected

Update on this:  I found a workaround.

 

Instead of checking the value of the variable I can write an expression using the empty() function

SolutionSupp.png

So the above expression reads as:

empty(variables('Supplier')) is equal to true.

 

 

View solution in original post

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (6,678)