cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
EdBenton
Regular Visitor

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?

17 REPLIES 17
efialtes
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

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
Advocate IV
Advocate IV

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

 

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

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. 

that didnt work either!

@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

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

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.

 

 

 

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

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

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!

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

Still looks like a bug to me.

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

darrenmuscat
Frequent Visitor

This is an alternative to display a Yes or No based on a Sharepoint boolean value,

@{if(equals(true,body('Get_item_-_eForm_Data')?['ColumnName']),'Yes','No' )}

or paste in Expression as:

if(equals(true,body('Get_item_-_eForm_Data')?['ColumnName']),'Yes','No' )

 

 

Reminder for me as well for the near future 🙂

As of April 2021,  simple 'equal to'  true (all small cap, no quote around the word) in standard mode seems to be working.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,215)