Find Salesforce Guest User Profiles Object Access

Find Salesforce Guest User Profiles Object Access

ObjectPermissions object/entity should be queried for Profile of UserType Guest to find Salesforce Guest User Profiles Object Access.

Sample Apex Code:

List < ObjectPermissions > listObjPerms = [
	SELECT Parent.Profile.Name, sObjectType, PermissionsCreate, 
	PermissionsRead, PermissionsEdit,
	PermissionsDelete, PermissionsModifyAllRecords, 
	PermissionsViewAllRecords
	FROM ObjectPermissions
	WHERE ParentId IN (
	SELECT Id
	FROM PermissionSet
	WHERE Profile.UserType = 'Guest'
	)
	AND PermissionsRead = true 
];

for ( ObjectPermissions objPerm : listObjPerms ) {

	System.debug(
		objPerm.Parent.Profile.Name + 
		' - ' + 
		objPerm.sObjectType
	);

}

Leave a Reply