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

describeSObjects(), query(), retrieve()

Fields

Field Name Details
Description
Type
textarea
Properties
Filter, Group, Nillable, Sort
Description
A description of the custom permission. Limit: 255 characters.
DeveloperName
Type
string
Properties
Filter, Group, Sort
Description
The unique name of the custom permission in the API. This name can contain only underscores and alphanumeric characters and must be unique in your organization. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores. The label corresponds to Name in the user interface. Limit: 80 characters.
Note

Note

When creating large sets of data, always specify a unique DeveloperName for each record. If no DeveloperName is specified, performance may slow while Salesforce generates one for each record.

Language
Type
picklist
Properties
Filter, Group, Restricted picklist, Sort
Description
The language of the custom permission. Valid values are:
  • Chinese (Simplified): zh_CN
  • Chinese (Traditional): zh_TW
  • Danish: da
  • Dutch: nl_NL
  • English: en_US
  • Finnish: fi
  • French: fr
  • German: de
  • Italian: it
  • Japanese: ja
  • Korean: ko
  • Norwegian: no
  • Portuguese (Brazil): pt_BR
  • Russian: ru
  • Spanish: es
  • Spanish (Mexico): es_MX
  • Swedish: sv
  • Thai: th
MasterLabel
Type
string
Properties
Filter, Group, Sort
Description
The custom permission label, which corresponds to Label in the user interface. Limit: 80 characters.
NamespacePrefix
Type
string
Properties
Filter, Group, Nillable, Sort
Description
The namespace prefix associated with this object. Each Developer Edition organization that creates a managed package has a unique namespace prefix. Limit: 15 characters. You can refer to a component in a managed package by using the namespacePrefix__componentName notation.
The namespace prefix can have one of the following values:
  • In Developer Edition organizations, the namespace prefix is set to the namespace prefix of the organization for all objects that support it. There is an exception if an object is in an installed managed package. In that case, the object has the namespace prefix of the installed managed package. This field’s value is the namespace prefix of the Developer Edition organization of the package developer.
  • In organizations that are not Developer Edition organizations, NamespacePrefix is only set for objects that are part of an installed managed package. There is no namespace prefix for all other objects.

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)

See Also