1

I have recently added a Flow button in a SharePoint Library. I found the code on internet (I have no experience in JSON).

I would like the button to be visible if:

  1. Document status (choice column) is different than Approved
  2. Approvers (person column) is not empty
  3. Ready for Approval (boolean column) is True

I could implement only one condition: Document status (choice column) is different than Approved

But I wonder how can I add the other 2 conditions?

Any help would more than appreciated.

The code looks like this:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "span",
  "style": {
    "color": "#001f00"
  },
  "children": [
    {
      "elmType": "button",
      "style": {
        "border": "light",
        "background-color": "Orange",
        "color": "#001f00",
        "cursor": "pointer",
        "visibility": {
          "operator": "?",
          "operands": [
            {
              "operator": "!=",
              "operands": [
                "[$Document_x0020_status]",
                "Approved",
              ]
            },
            "visible",
            "hidden"
          ]
        }
      },
      "txtContent": "Send to Approval",
      "customRowAction": {
        "action": "executeFlow",
        "actionParams": "{\"id\": \"53c665d0-ce12-4148-aa5a-c7202557ea78\"}"
      }
    }
  ]
}
  • Is "Approvers" column is single selection or multiple selection column? – Ganesh Sanap Jul 3 at 10:04
  • is a multiple selection column – claudia Jul 27 at 9:36
0

Try using this:

{
    "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
    "elmType": "span",
    "style": {
        "color": "#001f00"
    },
    "children": [
        {
            "elmType": "button",
            "style": {
                "border": "light",
                "background-color": "Orange",
                "color": "#001f00",
                "cursor": "pointer",
                "display": "=if([$Document_x0020_status]!='Approved' && [$Approvers] && [$Ready for Approval],'block','none')"
            },
            "txtContent": "Send to Approval",
            "customRowAction": {
                "action": "executeFlow",
                "actionParams": "{\"id\": \"53c665d0-ce12-4148-aa5a-c7202557ea78\"}"
            }
        }
    ]
}

Note: You need to use the internal name of your columns in JSON.

| improve this answer | |
  • Hi @claudia, have you tried this? is it working for you? – Ganesh Sanap Jul 7 at 5:48
  • Thank you Ganesh! I have tried it, but it did not work. I have modifiied this part: "display": "=if([$Document_x0020_status]!='Approved' && [$Approvers]!=’’ && [$Ready_x0020_for_x0020_Approval]!=’Yes’,'block','none')" – claudia Jul 27 at 9:34
  • Is it working now? or you are still facing some issues? – Ganesh Sanap Jul 27 at 9:41
  • no it is not working – claudia Jul 27 at 15:21
  • If your "Ready for Approval" column is of type boolean(Yes/No) then you need to check it like [$Ready for Approval]==false if you want to show the button if Ready for Approval is "No". – Ganesh Sanap Jul 27 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.