- 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.
No comments:
Post a Comment