3

Can this be done using 1 SOQL Query? I came up with the following:

SELECT Id, Name
FROM Profile
WHERE Id in
    (SELECT Parent.ProfileId
    FROM ObjectPermissions
    WHERE SObjectType = 'Account'
      AND (PermissionsCreate = true OR PermissionsEdit = true))

But this gives me an error:

The inner select field 'Parent.ProfileId' cannot have more than one level of relationships

This could probably be done in 2 queries, but it would be ideal for me to retrieve in a single result set otherwise I would have to write a script to combine results.

0

1 Answer 1

1

You can just modify my answer here slightly to get edit access:

SELECT Profile.Name FROM PermissionSet
WHERE IsOwnedByProfile = true AND Id IN (
    SELECT ParentId FROM ObjectPermissions
    WHERE PermissionsEdit = true
    AND SObjectType = 'Account'
)
3
  • 1
    Yeah, you are right :) I might just delete this Q and upvote your other answer. Thanks.
    – dana
    Commented May 1, 2017 at 18:31
  • Or maybe I'll just keep it... meta.stackoverflow.com/questions/265736/… - In any case, thanks!
    – dana
    Commented May 1, 2017 at 18:39
  • 1
    @dana Great find on Meta! Creating canon. :) Tis a good signpost.
    – Adrian Larson
    Commented May 1, 2017 at 18:59

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