1
votes

I am trying to run below query in Salesforce Developer Console to find out how many permissionSetIDs exist with View All Data Permissions or View All Opportunities. What's wrong with the below query?

SELECT Id, Name, PermissionsViewAllData, IsOwnedByProfile 
FROM PermissionSet
WHERE Id IN (SELECT ParentId 
             FROM ObjectPerms 
             WHERE SobjectType='Opportunity' 
               AND PermissionsViewAllRecords=true)

I see below error:

WHERE Id INn (SELECT ParentId FROM ObjectPerms WHEREe SobjectType='Opportunity'

ERROR at Row:1:Column:112 sObject type 'ObjectPerms' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.

1

1 Answers

0
votes

You just need to change object name to correct type from ObjectPerms to ObjectPermissions

SELECT Id, Name, PermissionsViewAllData, IsOwnedByProfile
FROM PermissionSet
WHERE Id IN (SELECT ParentId
             FROM ObjectPermissions
             WHERE SobjectType='Opportunity'
               AND PermissionsViewAllRecords=true)