cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
EdBenton
Level: Power Up

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
efialtes
Level 8

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

@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

arbangara99
Level: Powered On

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

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')

 

 

I_like_PI
Level: Powered On

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

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

 

arbangara99
Level: Powered On

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

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

I_like_PI
Level: Powered On

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

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. 

arbangara99
Level: Powered On

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

that didnt work either!

I_like_PI
Level: Powered On

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

@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

arbangara99
Level: Powered On

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

@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.

I_like_PI
Level: Powered On

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

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.

 

 

 

arbangara99
Level: Powered On

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

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

Microsoft EPC
Microsoft

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

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

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

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!

MyUsername
Level: Powered On

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

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

RKushner
Level: Powered On

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

Still looks like a bug to me.

RichardK
Level: Powered On

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

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
firstImage

Power Platform Online Conference

Speakers, submit your sessions now! Call for speakers ends Feb. 10!

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!

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 (Last 30 Days)
Users online (5,212)