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\"}"
      }
    }
  ]
}
2
  • Is "Approvers" column is single selection or multiple selection column? Jul 3, 2020 at 10:04
  • is a multiple selection column
    – claudia
    Jul 27, 2020 at 9:36

1 Answer 1

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. You can get the internal name of your column by following this article: How to find the Internal name of columns in SharePoint Online?

8
  • Hi @claudia, have you tried this? is it working for you? Jul 7, 2020 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, 2020 at 9:34
  • Is it working now? or you are still facing some issues? Jul 27, 2020 at 9:41
  • no it is not working
    – claudia
    Jul 27, 2020 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". Jul 27, 2020 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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