Forum Discussion
Column formatting / Show or hide columns based on user permission
Unfortunately, it does not work in sharepoint 2019.
Is it possible to modify it for sharepoint 2019?
- ganeshsanapSep 03, 2022MVP
Ivan_Volkov For SharePoint 2019, you have to use the Abstract Syntax Tree (AST) expressions using operator and operands. Try this:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v1/column-formatting.schema.json", "elmType": "div", "style": { "visibility": { "operator": "?", "operands": [ { "operator": ">=", "operands": [ "[$PermMask]", "0xb00" ] }, "hidden", "visible" ] } }, "txtContent": { "operator": "?", "operands": [ { "operator": ">=", "operands": [ "[$PermMask]", "0xb00" ] }, "read-only", "more than read" ] } }
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- Ivan_VolkovSep 03, 2022Copper Contributor
Thank you! Unfortunately, it didn't help.
I assumed that the problem is in the json-schemas/sp/v2 it should be json-schemas/sp/v1
https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting#apply-formatting-based-on-date-ranges
It didn't help.
Either I format the column incorrectly, or, maybe, the problem is in "[$PermMask]",
"0xb00" - it differs from Sharepoint Online.- ccarr1025Nov 17, 2022Copper Contributor
Ivan_Volkov did you figure out a way around this? I'm trying to accomplish the same thing.