2.3K
How to Check Logged in User has a Custom Permission in Salesforce
As of the Winter 18 Release, use the FeatureManagement
class to identify the logged in User has a Custom Permission. below are the simple example to call the FeatureManagment
checkPermission(apiName) – Checks whether a custom permission is enabled.
Boolean hasPermission = FeatureManagement.checkPermission('CustomPermissionAPIName');
Note. You can also use the FeatureManagement.checkPermission method to check if the user has been assigned a custom permission without SOQL
Reference:
FeatureManagement