0

My objective is to get a list of AccountShare records related to groups where a specific user is in.

How would I write this query?

1
  • 1
    What did you try so far? Mar 15 '17 at 13:38
0

You can use something like this:

SELECT Id, UserOrGroupId FROM AccountShare WHERE UserOrGroupId IN: 'hereYourUserOrGroup'

0

If you have access to Apex, you can do it with two queries. I don't believe it can be reduced to one:

List<Group> relatedGroups = [
    SELECT Id FROM Group WHERE Id IN (
        SELECT GroupId FROM GroupMembmer WHERE UserOrGroupId = :userId
    )
];
List<AccountShare> shares = [
    SELECT AccountId FROM AccountShare
    WHERE UserOrGroupId IN :relatedGroups
]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.