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

How to test SharePoint Yes/No (boolean) field in condition

I am trying to check a SharePoint Yes/No (boolean) field for a true condition. The condition always fails. I have tried to see it it is equal to "Yes", "True" and "1" with no success. Can someone assist with how to use a condition to test a SharePoint Yes/No field?

15 REPLIES 15
Highlighted
Kudo Kingpin
Kudo Kingpin

@EdBenton

Not sure how to do it in normal mode, but I succeded when switched to advanced mode.

This is an example of a condition that evaluates two boolean fields from a Sharepoint Item. This condition only succeeds if "Permanent" equals false and "Notify" equals true.

 

@and(not(triggerBody()['Permanent']), triggerBody()['Notify'])

 

Hope this helps

Highlighted

I am also trying to get the boolean condition check working on Flow. This is my logic as in advance mode where "Submit" is the boolean column name, any idea why it is not working?

 

@equals(triggerBody()?['Submit'], 'True')

 

 

Highlighted
Advocate IV
Advocate IV

I'm a newb so my apologies, but just to confirm, did you try =1 or ="1"

 

Highlighted

I didn't. However as stated in the first post ont his thread, EdBenton has tried that already it seems.

Highlighted

Sorry for the distraction, I was trying to point out the quotes. The boolean state shouldn't be compared to the literal 1 character but the numeric. His original post has the 1 character in quotes. So if it has been tried great but I didn't see it in his text. 

Highlighted

that didnt work either!

Highlighted

@efialtespointed out you refer to the item directly where you have:

     @equals(triggerBody()?['Submit'], 'True')

have you tried

    @triggerBody()['Submit']

or

    @and(triggerBody()['Submit'])

with no second arguement?

 

Good luck

Highlighted

@triggerBody()['Submit'] works first time. But when I edit my flow after this, I am not able to save it as the condition fields are empty.

Highlighted

It doesn't look like anyone else is weighing in so.

@equals(triggerBody()?['Submit']*1, 1)

 

Sometimes if you force the math true false items will give you what you want.

& that's the last of my bag o tricks.

 

 

 

Highlighted

Flow doesnt accept this as a vlid syntax. '*' is not expected they say..

Highlighted
Microsoft
Microsoft

I just had success using this conditional formula (in advanced mode) to read in a Yes/No boolean checkbox from SharePoint: 

@equals(triggerBody()?['MyFieldName'], bool(1))

Highlighted
Anonymous
Not applicable

Even in Advanced mode the code reverts to testing for a string.  This had me confused for a long time until I applied some 'logic' and in a moment of inspiration edited the default syntax.  

 

See the post here

 

Removing the single quotes from the string 'true' turned it into the boolean true I was after.

So;

 

@equals(triggerBody()?['value'], 'true')    fails

@equals(triggerBody()?['value'], true)     works

 

Hope this helps!

Highlighted

@AnonymousYou are my hero, saved me a lot of time, couldn't find the way to make this work, thank you!

Highlighted

Still looks like a bug to me.

Highlighted

It does seem like a bug. You can put true in as an expression, which has the same effect as removing the quotes.

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.

Users online (12,994)