Forum Discussion

ful562045's avatar
ful562045
Copper Contributor
Nov 01, 2023

SharePoint Json button

Hi

i have this code for a button in a sharepoint list, and i want to add something into this code so that only certain users the button will appear for and others it will remain hidden from view. is this possible

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "txtContent": "Notify IT",
  "customRowAction": {
    "action": "setValue",
    "actionInput": {
      "Status": "With IT"
    }
  },
  "style": {
    "background-color": "Red",
    "color": "white",
    "visibility": "=if([$Status] == '','hidden',if([$Status] == 'IT Approved','hidden',if([$Status] == 'With IT','visible','hidden',)"
  }
}

 

,

 

  • No, it's unfortunatly not possible to hardcode filtering of permissions based on users nor groups using View formatting json.

    A work around would be to create audience targeting in a view using Classic SharePoint and then go back to modern.

Resources