Forum Discussion

Sportback's avatar
Sportback
Copper Contributor
Dec 11, 2021
Solved

Sharepoint/Lists - Toggle if statement

Hi everyone, This simple "if statement" does not work. The toggle "NO to YES" works, but does not work "YES to NO"      { "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column...
  • ganeshsanap's avatar
    ganeshsanap
    Dec 13, 2021

    Sportback I am able to update choice column as well. Here's JSON I am using:

     

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
      "elmType": "div",
      "customRowAction": {
        "action": "setValue",
        "actionInput": {
          "Paye": "=if([$Paye] == 'OUI', 'NON', 'OUI')"
        }
      },
      "children": [
        {
          "elmType": "button",
          "attributes": {
            "class": "ms-bgColor-purple--hover ms-fontColor-white--hover ms-fontColor-gray140 ms-bgColor-gray30"
          },
          "txtContent": "PAYER",
          "style": {
            "padding": "2px 15px 13px 15px",
            "height": "23px",
            "border": "none",
            "border-radius": "8px",
            "cursor": "pointer",
            "box-shadow": "rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px"
          }
        }
      ]
    }

     

    Output

     

    Choice column settings


    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.

Resources