Query Which Profiles Have Read Access To Specific Object?

Since I couldn’t think of how to write this query off the top of my head, I thought it might be worth sharing. How can I query which Profiles have Read permission on a specific object? I knew it would have something to do with ObjectPermissions and PermissionSet, but had to look up the documentation for both to piece it together.


The first query I got to work was on the ObjectPermissions object:

SELECT Parent.Profile.Name FROM ObjectPermissions
WHERE Parent.IsOwnedByProfile = true AND SObjectType = 'MyObject__c'

This query gets exactly the data I wish, but in the Query Editor, gives the dreaded:

[object Object]

Left Inner Join to the rescue! More palatable:

SELECT Profile.Name FROM PermissionSet
WHERE IsOwnedByProfile = true AND Id IN (
    SELECT ParentId FROM ObjectPermissions
    WHERE PermissionsRead = true
    AND SObjectType = 'MyObject__c'

Source : Link , Question Author : Adrian Larson , Answer Author : Adrian Larson

Leave a Comment