Skip to content

Instantly share code, notes, and snippets.

@sfdcale
Last active May 1, 2019 17:20
Show Gist options
  • Select an option

  • Save sfdcale/e7311e7f31d9f0684674c5bad2cfc978 to your computer and use it in GitHub Desktop.

Select an option

Save sfdcale/e7311e7f31d9f0684674c5bad2cfc978 to your computer and use it in GitHub Desktop.
Object Permissions by Profile and Permission Sets
//Run the below query to see what access Profiles('System Administrator','Standard User') are giving to objects('Lead','Account')
SELECT sobjecttype,
Parent.Profile.Name,
permissionscreate,
permissionsdelete,
permissionsviewallrecords,
permissionsmodifyallrecords,
permissionsread,
permissionsedit
FROM objectpermissions
WHERE sobjecttype IN ( 'Lead', 'Account','LicensePolicy__c','abc__c','NLS_Billing_Item__c' )
AND parentid IN (SELECT id
FROM permissionset
WHERE isownedbyprofile = true
AND profile.NAME IN ( 'System Administrator',
'Standard User' ))
//Run the below query to see what access PermissionSets('PS_One','PS_Two') are giving to objects('Lead','Account')
SELECT parent.label,
sobjecttype,
permissionscreate,
permissionsdelete,
permissionsviewallrecords,
permissionsmodifyallrecords,
permissionsread,
permissionsedit
FROM objectpermissions
WHERE sobjecttype IN ( 'Lead', 'Account' )
AND parentid IN (SELECT id
FROM permissionset
WHERE isownedbyprofile = false
AND label IN ( 'PS_One', 'PS_Two' ))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment