Friday 4 May 2018

How to Check if the Current/Running User has a Custom Permission in Salesforce?

FeatureManagement:

For this requirement we can use FeatureManagement.checkPermission method to identify Current/Running User has a Custom Permission. This method available from Winter 18 onwards.

checkPermission(apiName)
Checks whether a custom permission is enabled.

   Signature
      public static Boolean checkPermission(String apiName)
   Parameters
      apiName
   Type: String

Example:
  1. if(FeatureManagement.checkPermission('Chat_CustomPermission_Access')){
  2.     // Perform some logics.
  3. }

Reference:
FeatureManagement

No comments:

Post a Comment

Activities: Assign Tasks to a Queue Salesforce Lightning

Salesforce announced to assign Tasks to a Queue beginning from Spring'20 release. How does it work? In Setup, enter Queues in th...