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

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.

To grant users access to an entity, associate the appropriate SetupEntityAccess record with a PermissionSet that’s assigned to a user.

## Supported Calls

create(), delete(), describeSObjects(), query(), retrieve()

## Special Access Rules

As of Spring ’20 and later, only users with "View Setup and Configuration" permission can access this object.

## Fields

| Field Name | Details |
| --- | --- |
| ParentId | 
Type

reference

Properties

Create, Filter, Group, Sort

Description

The ID of the entity’s parent PermissionSet.

This is a relationship field.

Relationship Name

Parent

Relationship Type

Lookup

Refers To

PermissionSet



 |
| SetupEntityId | 

Type

reference

Properties

Create, Filter, Group, Sort

Description

The ID of the entity for which access is enabled, such as an Apex class or Visualforce page.



 |
| SetupEntityType | 

Type

picklist

Properties

Filter, Group, Nillable, Restricted picklist, Sort

Description

The type of setup entity for which access is enabled. Valid values are:

- ApexClass for Apex classes
- ApexPage for Visualforce pages
- In API version 64.0 and later, BotDefinition for agents
- In API version 28.0 and later, ConnectedApplication for OAuth connected apps
- In API version 48.0 and later, CustomEntityDefinition for Custom Settings and Custom Metadata Types
- In API version 31.0 and later, CustomPermission for custom permissions
- In API version 62.0 and later, EmailRoutingAddress for email routing addresses.
- In API version 60.0 and later, ExternalClientApplication for external client apps.
- In API version 58.0 and later, ExternalCredentialParameter for external credential principals.
- In API version 58.0 and later, FlowDefinition for flows
- In API version 62.0 and later, MessagingChannel for messaging channels
- In API version 58.0 and later, OrgWideEmailAddress for organization-wide email addresses
- In API version 28.0 and later, ServiceProvider for service providers
- In API version 60.0 and later, StandardInvocableActionType for standard invocable actions.
- In API version 28.0 and later, TabSet for apps





 |

## Usage

Because SetupEntityAccess is a child of the PermissionSet object, the usage is similar to other PermissionSet child objects like FieldPermissions and ObjectPermissions.

For example, the following code returns all permission sets that grant access to any setup entities for which access is enabled:

SELECT Id, ParentId, Parent.Name, SetupEntityId
FROM SetupEntityAccess

The following code returns permission sets that grant access only to Apex classes:

SELECT Id, ParentId, Parent.Name, SetupEntityId
FROM SetupEntityAccess
WHERE SetupEntityType='ApexClass'

The following code returns permission sets that grant access to any setup entities, and are not owned by a profile:

SELECT Id, ParentId, Parent.Name, SetupEntityId
FROM SetupEntityAccess
WHERE ParentId
IN (SELECT Id
   FROM PermissionSet
   WHERE isOwnedByProfile = false)

You may want to return only those permission sets that have access to a specific setup entity. To do this, query the parent object. For example, this code returns all permission sets that grant access to the helloWorld Apex class:

SELECT Id, Name,
   (SELECT Id, Parent.Name, Parent.Profile.Name
   FROM SetupEntityAccessItems)
FROM ApexClass
WHERE Name = 'helloWorld'

While it’s possible to return permission sets that have access to a ConnectedApplication, ServiceProvider, or TabSet by SetupEntityId, it’s not possible to return permission sets that have access to these SetupEntityType fields by any other AppMenuItem attribute, such as Name or Description. For example, to find out if a user has access to the Recruiting app, you’d run two queries. First, query to get the AppMenuItem ID:

SELECT Id, Name, Label
FROM AppMenuItem
WHERE Name = 'Recruiting'

Let’s say the previous query returned the AppMenuItem ApplicationId 02uD0000000GIiMIAW. Using this ID, you can now run a query to find out if a user has access to the Recruiting app:

SELECT Id, SetupEntityId, SetupEntityType
FROM SetupEntityAccess
WHERE ParentId
IN
   (SELECT PermissionSetId 
   FROM PermissionSetAssignment
   WHERE AssigneeId = '005D0000001QOzF')
AND (SetupEntityId = '02uD0000000GIiMIAW')

#### See Also

- [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.")
- [FieldPermissions](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_fieldpermissions.htm "Represents the enabled field permissions for the parent PermissionSet. This object is available in API version 24.0 and later.")
- [ObjectPermissions](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_objectpermissions.htm "Represents the enabled object permissions for the parent PermissionSet. This object is available in API version 24.0 and later.")
- [ApexClass](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_apexclass.htm "Represents an Apex class.")
- [ApexPage](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_apexpage.htm "Represents a single Visualforce page.")