---
schema_version: "1"
id: e4f067dd839bd42de4d0d7d6380748f71ebde1037c74bf76fc7d4edd49088f5d
title: CustomPermission
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/object_reference/sforce_api_objects_custompermission.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_custompermission.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: c99fa68bbb99c2992a6e90a190444505d1022592e767b47d1ee7db6688ad6465
description: 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.
---
# 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

| 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](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/images/icon_note.png)

#### 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.

![Note](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/images/icon_note.png)

#### Note

Only users with View DeveloperName OR View Setup and Configuration permission can view, group, sort, and filter this field.















 |
| IsLicensed | 

Type

boolean

Properties

Defaulted on create, Filter, Group, Sort

Description

When enabled (true) indicates that the appropriate Salesforce license is required before accessing the permission. This field is available in API version 50.0 and later.



 |
| IsProtected | 

Type

boolean

Properties

Defaulted on create, Filter, Group, Sort

Description

Indicates whether the custom permission is protected (true) or not (false). Protected components that have been installed in other organizations can’t be linked to or referenced by components created in the subscriber organization. A developer can delete a protected component contained in a managed package in a future release of the package without worrying about failing installations. However, after a component is marked as unprotected and is released globally, the developer can’t delete it. The default value is false. This field is available in API version 50.0 and later.



 |
| 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 Spanish (Mexico) defaults to Spanish for customer-defined translations.
- Swedish: sv
- Thai: th The Salesforce user interface is fully translated to Thai, but Help is in English.





 |
| 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 that is associated with this object. Each Developer Edition org 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 orgs, NamespacePrefix is set to the namespace prefix of the org for all objects that support it, unless 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 org of the package developer.
- In orgs that are not Developer Edition orgs, NamespacePrefix is set only for objects that are part of an installed managed package. All other objects have no namespace prefix.





 |

## 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

- [CustomPermissionDependency](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_custompermissiondependency.htm "Represents the dependency between two custom permissions when one custom permission requires that you enable another custom permission. This object is available in API version 32.0 and later.")
- [PermissionSet](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_permissionset.htm "Represents a set of permissions that’s used to grant more access to one or more users without changing their profile or reassigning profiles. This object is available in API version 22.0 and later.")
- [Profile](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_profile.htm "Represents a profile, which defines a set of permissions to perform different operations. Operations can include creating a custom profile or querying, adding, updating, or deleting information.")
- [SetupEntityAccess](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_setupentityaccess.htm "Represents the enabled setup entity access settings (such as for Apex classes) for the parent PermissionSet. This object is available in API version 25.0 and later.")