CustomPermission
Represents a permission created to control access to a custom
process or app, such as sending email. This object is available in API version 31.0
and later.
Supported Calls
describeLayout(), describeSObjects(), query(), retrieve()
Special Access Rules
As of Summer ’20 and later, only users who have one of these permissions can access
this object:
- View Setup and Configuration
- Manage Session Permission Set Activations
- Assign Permission Sets
Fields
Usage
Use the CustomPermission object to determine users’ access to custom permissions.
For example, to query all permission sets where the Button1 permission is
enabled:
SELECT Id, DeveloperName,
(select Id, Parent.Name, Parent.Profile.Name from SetupEntityAccessItems)
FROM CustomPermission
WHERE DeveloperName = 'Button1'
To query all permission sets and profiles with custom
permissions:
SELECT Assignee.Name, PermissionSet.Id,
PermissionSet.Profile.Name,
PermissionSet.isOwnedByProfile,
PermissionSet.Label
FROM PermissionSetAssignment
WHERE PermissionSetId
IN (SELECT ParentId
FROM SetupEntityAccess
WHERE SetupEntityType =
'CustomPermission')
To query for all SetupEntityAccess rows with custom
permissions:
SELECT Id,ParentId,Parent.Name, SetupEntityId
FROM SetupEntityAccess
WHERE SetupEntityType='CustomPermission'
AND ParentId
IN (SELECT Id
FROM PermissionSet
WHERE isOwnedByProfile = false)