Salesforce Fact #174 | Custom permission check in LWC
Suppose we have a use case in LWC where we need to make an input field editable based on whether the logged in user has a custom permission assigned. We can make use of @salesforce/customPermission import to check whether the user is assigned the custom permission or not.
The interesting point here is if the user is not assigned the custom permission it returns undefined, not false.
Attached are the screenshots.
Hello...indeed true.However there's one particular case where the behaviour si quite weird.
ReplyDeleteSuppose the same logique is to be applied for a manage package,then after successfull install in the target org,it still return true even though the connected user don't have the permission set assigned.
Had to rewrite everything in apex to cater for such scenarios
Thanks for sharing. Was not aware of this one.
Delete