function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
R TyeR Tye 

Quick Apex Account team and sharing question!

Hello,
 
Is there some type of groupID associated with the Accountteammember object?  In the different share objects you can create a sharing rule by assigning a UserorGroupId to the share record. 
 
I am attempting to write a trigger to share a case with all the members in a single Account team.  Is there a single Accountteammember GroupId that I can create a case sharing record off of? Or do I have to create a new sharing rule for each individual member in the Account team? 
 
If this isn't possible, would a possible solution be to create a new Group (containing all the members from that account)?  This way I would have an group wrapper to represent all the userId's related to that account and could create a caseshare rule using that ID.
 
Thanks!


Message Edited by R Tye on 01-29-2008 02:08 PM
mtbclimbermtbclimber
There is no special group for the set of accountteammembers associated to a single account.

If you want to use that data you would need to query the accountteamMembers for the account and then create a caseShare for each one.

The group approach is probably better but either way there are some issues with managing shares programatically - through apex or even just the API. One if the biggest is that changing owner on case will cause your shares to be deleted.
R TyeR Tye
Thanks for the reply Andrew, also thanks for the help during the conference in San Francisco :smileyvery-happy:  I will probably pursue the group sharing model in that case.  Is there anyway to lock down the case owner field or create a trigger that will prevent modification?  We do not intend to utilize or change it for any reason...