+ Start a Discussion

Share account record with a Role in Apex

Is there any way to share an account record with a role using Apex? As far as I know the answer is 'no', unless somebody has figured it out.


The problem is:

UserOrGroupId is a reference to a Group or User, NOT a Role, because of this I cannot link AccountShare record to a role, or create a GroupMember linked to a role.


Imran MohammedImran Mohammed

I think there is no other way of doing that except create a group and link a role to it as you mentioned.