Checking Custom Permission Access with Apex

In Salesforce, a custom permission allows one to define whether or not a user has access to some custom feature declaratively through profiles and permission sets.

When custom permissions originally came out, one could only “easily” check if a user had access through Visualforce, Formula Fields, or Validation Rules. One could check in Apex through querying some system Objects but that was not as “easy”. Andy Fawcett’s Native Apex support for Custom Permissions idea show’s the exact usage and why he requested that it be easier.

Recently, I discovered that Salesforce did provide an easier way through the native “FeatureManagement” Apex API and it’s as easy as calling the “checkPermission” function.

Leave a Reply

Your email address will not be published. Required fields are marked *