0

A sharing rule exists in Account which under certain criteria shares the record with a Role.

Is there a way we can query AccountShare object or any other table to check what Roles are Accounts shared with?

The relatedId in Group object says "For Groups of type “Role,” the ID of the associated UserRole."

2

Yes sure.

You can use SOQL like bellow:

SELECT AccountAccessLevel , AccountId , CaseAccessLevel , ContactAccessLevel , Id , IsDeleted , LastModifiedById , LastModifiedDate , OpportunityAccessLevel , RowCause , UserOrGroupId FROM AccountShare WHERE RowCause = 'Rule'

This will give you all account rows those are shared to Role. If you are interested in perticuler role then you can add condition like AND WHERE UserOrGroupId = 'ROLE_ID_XXXX'

0

You can't directly get the Role id from the Single Query.

You need to query in such a way :

[select relatedid from Group where id in (SELECT UserOrGroupId FROM  customObject__Share where rowcause='Rule')]..

The RelatedId is the Id of role that has access/the role with the record is being shared.

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.