SOLVED

Sharepoint List Edit Form Conditional Formatting for Yes/No field

Brass Contributor

Hi,

I have been able to successfully add conditional formatting to my columns in my Edit form based on the Microsoft link below.  However, I can't get it to work for a Yes/No column.  I have used their example but the field always is hidden no matter what the value is.  I have tried true and false and in all CAPS as when I export my data that is how it appears but no success.

 

Has anyone been able to successfully use conditional formatting on a yes/no field in their list?  I would love to know the trick to make my form more user friendly :)  Thanks everyone for your help.

 

=if([$Category]==true,'true', 'false')

 

https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/list-form-conditional-show...

 

6 Replies

@cmaly 

I've tested this and it works OK for me. The formula you have listed has the correct syntax. One thing you might want to check is the internal name of your SharePoint column. The formula you list relies on the internal name being 'Category' - if it's anything else then it just won't work.

 

To check the internal name, go to your list/library settings, click on the 'Category' column in the 'Columns' section and in the address bar of your browser, right at the end you should see something like '&Field=Category' (if 'Category' is indeed the internal name). If it is something different then you need to use this in your formula.

 

Hope that helps.

@Joe Ayre  Good morning,

 

Did you test on a Yes/No type column?  I have been able to do it with everything but this type.  I even created a test Choice column with yes no as the selections and it worked that way but I would prefer not to have to change my column just for this.

 

I did double check my name on the couple of fields I am trying this for and that does not seem to be the issue.  

 

Here are some screenshots.  First is the Field name and second is the formula I used.  No matter what value is in the Worked in Sprint column (yes or no) the field does not appear.

 

Thoughts?

sharepoint.png

sharepoint2.png

@cmaly yes - I did test with a Yes/No column.

Looking at your screenshot, I can see that the internal name of your 'Worked in Sprint' column is actually "Worked_in_Sprint' - the %5Fx0020%5F represents an underscore character.

I would try again with the following formula:

 

=if([$Worked_in_Sprint]==false,'true','false')

 

Please click Accept as solution if my post helped you solve your issue. This will help others find the correct solution easily. It also closes the item. If the content was useful in other ways, please consider giving it Like.

@cmaly I think you are facing this issue because you are using wrong internal name of your column.

Check below link for finding correct internal name of your column:

Find the internal name of SharePoint column 

 

Assuming internal name of your column is "BooleanCol", either of below should work for you:

 

=if([$BooleanCol]==true,'true','false')

 

OR

 

=if([$BooleanCol],'true','false')

 


 

Please click Accept as solution if my post helped you solve your issue. This will help others find the correct solution easily. It also closes the item. If the content was useful in other ways, please consider giving it Like.


best response confirmed by cmaly (Brass Contributor)
Solution

Thank you for your response.  I was unable to make it work with my column as it was.  I tested on a Test Sharepoint list that I have and confirmed it was the name of my column causing me trouble.  So I ended up creating a new Yes/No column that the naming did not have the x0020 between the words and now it is working fine.

 

Thanks again!

@cmaly 

Appreciate this is an old post but if it helps anyone, I had an issue today where one list column type was set to Yes/No, and enabling 'Format yes and no' correctly applied red shading to no, and green to yes. However, an adjacent column was a formula which also returned a Yes/No value but the formatting would not apply.

 

To resolve this I did following:
1) Copied the JSON from the column that was working (Column settings / Format this column / Format yes and no - Advanced mode)

2) Pasted the JSON into the column that didn't work (can also paste it direct into the field within the list settings) and change the words true to "Yes" and false to "No". Note that it did not work without the quotation marks.

1 best response

Accepted Solutions
best response confirmed by cmaly (Brass Contributor)
Solution

Thank you for your response.  I was unable to make it work with my column as it was.  I tested on a Test Sharepoint list that I have and confirmed it was the name of my column causing me trouble.  So I ended up creating a new Yes/No column that the naming did not have the x0020 between the words and now it is working fine.

 

Thanks again!

View solution in original post