SOLVED

How can users change Yes/No columns?

Occasional Contributor

What are the different ways I can tell my users how to change the value of a custom Yes/No column in the browser? It looks like my options are to tell them to either check the circle in the far left column that selects the item, and then scroll down the the item's properties and check or uncheck that option (although this seems to fail sometimes for me and I don't get much of an error message) or use grid view the check or uncheck the column. Similarly in the latter option I often get an error that says the file is locked by me, even though the file is not open anywhere in my session.

 

Are there any other options or settings I could use to make it a little easier on users?

4 Replies

@dgajohnson Try using JSON column formatting for your Yes/No column like below: 

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "inlineEditField": "@currentField",
  "txtContent": "=if(@currentField,'Yes','No')"
}

 

This will allow users to edit the column value inline from list/table view itself without going to properties form: 

ganeshsanap_0-1681286706744.png


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

@ganeshsanap thank you, this is working!


Do you know of a way to make it so that you can change the value with only one click? With this formatting the user has to click the cell, wait for it to load, and then change its value. Do you know of a method where the user could change the value with just one click?

best response confirmed by dgajohnson (Occasional Contributor)
Solution

@dgajohnson try using JSON sample given here: Yes/No Column Toggle screenshot (1).gif


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

@ganeshsanap thanks! I found that one too. I ended up using this:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "txtContent": "=if(@currentField, 'Yes', 'No')",
  "customRowAction": {
    "action": "setValue",
    "actionInput": {
      "MyCustomField": "=if(@currentField, false, true)"
    }
  },
  "style": {
    "background-color": "=if(@currentField, '#0078d4', '#ffffff')",
    "color": "=if(@currentField, '#ffffff', '#333333')",
    "border": "none",
    "cursor": "pointer",
    "padding": "4px 12px",
    "border-radius": "4px"
  }
}

ChatGPT made the style, and I pulled the customRowAction parameter from that repo.