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

Written by 

Salesforce MVP | Lightning Champion | 17x Salesforce Certified | Application Architect | 7x Trailhead Ranger | Techforce Services | Australia

Leave a Reply

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

*