Sunday, January 26, 2020

How To Access Custom Permission in Apex

  • Let's assume you have created a custom permission and it's been assigned to permission set or profiles.
  • Now we can refer the same custom permission in apex to check whether it's enabled for logged in user or not.
  • We use will the checkPermission() method from the FeatureManagement class for the same.

Boolean enabSet = System.FeatureManagement.checkPermission('Custom Permission APi Name');
System.debug('enabSet..'+enabSet);

Example:
Boolean enabSet = System.FeatureManagement.checkPermission('SreeTest');
System.debug('enabSet..'+enabSet);

Please comment or write us if you have any queries/requirements.

Please like,follow,bookmark,subscribe this site to receive daily updates.



Hope this helps you..Enjoy..!

No comments:

Post a Comment