Display/not dispaly through Fromat Column in SharePoint List

Li, York 61 Reputation points
2022-02-16T07:38:52.557+00:00

![Hi Everyone:
I want to display/hide the automate button "Update/Close" in SharePoint List according to the "Status" value, but when I use the "Format the Column" function, it doesn't work, can you help check whet is wrong?

When the status value is "Closed", I want to hide the button "Update/Close" , but the Json desn't work.

174875-list.png

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,563 questions
{count} votes

Accepted answer
  1. Yi Lu_MSFT 17,481 Reputation points
    2022-02-16T09:25:04.983+00:00

    Hi @Li, York
    You could try the following code:

    {  
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",  
      "elmType": "div",  
      "children": [  
        {  
          "elmType": "button",  
          "customRowAction": {  
            "action": "executeFlow",  
            "actionParams": "{\"id\": \"386b81a1-fce2-45da-a981-91160d0d9245\"}"  
          },  
          "attributes": {  
            "class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover"  
          },  
          "txtContent": "Updating/Close",  
          "style": {  
             "border": "none",  
             "background-color": "lightgreen",  
             "cursor": "pointer",  
             "display": "=if([$Status]=='Closed','none','inherit')"  
          }  
        },  
        {  
          "elmType": "span",  
          "style": {  
            "padding-right": "8px",  
            "display": "=if([$Status]=='Closed','inherit','none')"  
          },  
          "txtContent": "@currentField"  
        }  
      ]  
    }  
    

    Then if the status value is "Closed", you will hide the button "Update/Close" and you could add other value in this field.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.