You are here:
Control Access to Your Customized Features or UI Elements in Enterprise Sales Management (Managed Package)
Create custom permissions to manage user access to functionalities or customized UI components in ESM.
This feature is part of the Communications Cloud managed package.
| REQUIRED EDITIONS |
|---|
| Available in: Lightning Experience |
| Available in: Enterprise, Performance, Unlimited, and Developer Editions |
To create new custom permissions, see Create Custom Permissions.
The checkPermission API doesn’trecognize custom permissions that you’ve created as they are different from the custom permissions included with the ESM managed package. To ensure proper permission management, you must write a custom Apex code to invoke the FeatureManagement.checkPermission API. Then, invoke this custom Apex method from your customized UI to determine whether the user has the required permissions.
Here's a sample Apex code.
public static Map<String, Boolean> checkCustomPermissions(List<String> permissionList) {
Map<String, Boolean> result = new Map<String, Boolean>();
if(permissionList == null || permissionList.isEmpty()) {
return result;
}
for (String permissionName : permissionList) {
try{
boolean isPermissionAllowed = FeatureManagement.checkPermission(permissionName);
result.put(permissionName, isPermissionAllowed);
}catch(Exception ex) {
System.debug('Permission check failed for: ' + permissionName + '. Error: ' + ex.getMessage());
result.put(permissionName, false);
}
}
return result;
}

