0

I got this problem:

I have a button which should only be visible when the Approval Status is not "Genehmigt".

This is the JSON I got right now:

{
  "$schema": "https://developer.microsoft.com/en-us/json-schemas/sp/column-formatting.schema.json&#8221",
  "elmType": "span",
  "style": {
    "color": "#0078d7"
  },
  "children": [
    {
      "elmType": "button",
      "style": {
        "background-color": "green",
        "color": "white",
        "visibility": "if ([$Approval Status] == 'Genehmigt';false;true)"
      },
      "txtContent": "Freigabe anfordern",
      "customRowAction": {
        "action": "executeFlow",
        "actionParams": "{\"id\": \"304887e9-d4dc-431c-8383-9fda6b226991\"}"
      }
    }
  ]
}

Here nothing appears. Also tried it with [$ModerationStatus] also didn't work.

Hope you guys can help me with this!

1
  • Is this SharePoint default approval status column? – Ganesh Sanap Mar 8 at 13:14
0

In SharePoint JSON formatting, you have to use the internal name of list column.

If you are using SharePoint default Approval Status column, you need to use _ModerationStatus in your formula.

like:

"visibility": "=if([$_ModerationStatus] == 'Genehmigt', 'visible', 'hidden')"

OR

"display": "=if([$_ModerationStatus] == 'Genehmigt', 'block', 'none')"

If you are using the custom column you created, find out the internal name of your column using above link & use it instead.

Related posts:

  1. Display different flow buttons in sharepoint list with time condition
  2. Json in sharepoint column help
5
  • I tried it, but it still doesnt work. Its the default sharepoint column – Oliver Mar 8 at 13:23
  • Can you please check the internal name of your column? (add screenshot if possible) – Ganesh Sanap Mar 8 at 13:24
  • i cant find the column right here. is ther another way to get the internal name? i.stack.imgur.com/swG0m.png – Oliver Mar 8 at 13:29
  • I tested it my end, you need to use [$_ModerationStatus], check updated answer. Also make sure you have added approval status field in list view. – Ganesh Sanap Mar 8 at 13:33
  • Please Upvote(^) and accept as an Answer as it helped you. – Ganesh Sanap Mar 8 at 13:40

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.