Forum Discussion
How can users change Yes/No columns?
- Apr 12, 2023
dgajohnson try using JSON sample given here: Yes/No Column Toggle
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs
Is there a way to adjust this code to have it only apply to certain content types and/or apply only if another column meets a requirement?
My problem:
I have a Sharepoint list which contains both folders and excel files. With the current JSON, it automatically applies the pre-set value to all entities in the list where I only want it to show next to the excel files to avoid confusion.
sam77meyer Yes, you can hide the JSON formatting for folders using visibility or display properties inside style property.
Example:
"style": {
"visibility": "=if([$ContentType] == 'Folder', 'hidden', 'visible')"
},
Where ContentType is the internal name of your SharePoint list column which you have to use in this format: [$ContentType]. You can get the internal name of your SharePoint list columns by following this article: How to find the Internal name of columns in SharePoint Online?
You may have to show the Content Type column in your library view to read it's value in JSON.
Above JSON snippet is taken from here (full JSON example available): SharePoint Online: Download files using JSON Formatting
Please consider giving a Like if my post helped you in any way.
- sam77meyerNov 28, 2023Copper Contributor
Thanks for the reply ganeshsanap
Still having trouble after using the following JSON - only change I can get using variations of this code is it hiding the Yes/No for every content type.
- sam77meyerNov 28, 2023Copper ContributorSolved: Because it was reading the style script it showed nothing because I did not have any base style attributes listed. Working now