0

I have created an SP document library with an execution flow button that extracts the zip files when the users click it. The extract file locations are the same as the zip file in the document library.

My issue is that the extract files have the button option as well. Can I make that button available only for the zip files?

enter image description here

enter image description here

1 Answer 1

1

You can show/hide the JSON formatting button based on the file name using display property like:

"display": "=if(endsWith([$FileLeafRef], '.zip'), 'block', 'none')",

Full example:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\": \"edf627d9-20f4-45ba-8bc9-4494bf2ff1be\"}"
  },
  "attributes": {
    "class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover"
  },
  "style": {
    "display": "=if(endsWith([$FileLeafRef], '.zip'), 'block', 'none')",
    "cursor": "pointer"
  },
  "txtContent": "Extract file here"
}

Output:

enter image description here

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.