Sunday, October 4, 2020

How to check current user has a Custom Permission in Salesforce Using Apex?

To check the custom permission using Apex we can use the FeatureManagement class.

Demo:

Crate the custom permission


Sample Code:

Boolean bHasPermission = FeatureManagement.checkPermission('Test_Custom_Permission');
System.debug('has permission => '+bHasPermission);

Result:


No comments:

Post a Comment