cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
New Member

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
Highlighted
New Member

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (8,488)