0

Let's say we are near to create new profile but before there is need to verify that there are not such ones in org. How can we do it?

1 Answer 1

2

You can verify this with a simple query:

SELECT Profile.Name
FROM PermissionSet
WHERE Id IN (
  SELECT ParentId 
  FROM ObjectPermissions 
  WHERE PermissionsCreate = true AND 
    PermissionsEdit = false AND 
    sObjectType = 'Account')
  AND IsOwnedByProfile = true

This will give you all of the profiles where your desired conditions are met.

You can run this query directly from Developer Console (⚙ > Developer Console in Lightning, "Your Name" > Developer Console in Classic, or Setup > Develop > Apex Classes > Developer Console) on the Query Editor tab.

2
  • Thanks. Is it possible to filter somehow records related to Account only?
    – pincet
    Commented Mar 3, 2021 at 14:47
  • 1
    @pincet Yes, you can add AND sObjectType = 'Account' in the subquery.
    – sfdcfox
    Commented Mar 3, 2021 at 15:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .