function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
fiona gentryfiona gentry 

SOQL not showing object access record access

Hi,

Need a SOQL to find  list of users who have Admin profile and want to add some columns like object access , record access etc ... So i know  what these profile can do  below SOQL is not helping me much,can someone suggest what is missing here
SELECT sObjectType, PermissionsCreate, PermissionsRead, PermissionsEdit, PermissionsDelete, PermissionsModifyAllRecords,
PermissionsViewAllRecords FROM ObjectPermissions
WHERE ParentId IN ( SELECT Id
FROM permissionset
WHERE PermissionSet.Profile.Name = 'System Administrator' )

Thanks in advance
Fiona

 
Best Answer chosen by fiona gentry
PriyaPriya (Salesforce Developers) 
Hi Fiona,

The SOQL you have written will tell you what are the access level has been defined for each object(standard+custom) in the System Admin Profile.

And to know the list of users who are having system admin profile, for that you can write a separate SOQL 
 
List<User> userlist = [Select id, name, email from User where Profile.name = 'System Administrator'']


May i know if this what you are looking for ?

Thanks & Regards,

Priya Ranjan