April 6, 2021

How to query all the Apex Classes the profile have access to in Salesforce?

1. Run the below SOQL to get the PermissionSet Id.
SELECT Id, Profile.Name FROM PermissionSet WHERE Profile.Name = 'System Administrator'

2. Use the PermissionSet Id from the step 1 and use it in the below SOQL for ParentId.
SELECT Name FROM ApexClass WHERE Id IN ( SELECT SetupEntityId FROM SetupEntityAccess WHERE ParentId = '0PS4x000003oZ9DGAU' AND SetupEntityType = 'ApexClass' )
 

No comments:

Post a Comment