Currently with this trigger I created, if a portal user creates a commission split it will be shared with the group that the portal user is in. Recently they told me that it needs to be shared with multiple other users so they can go through the approval process. Is there anyway I can edit my current trigger to do this?
Map<id,User>PartnerUsermap = new Map<id,User>([select id,UserType from user where UserType = 'PowerPartner' and isActive = true] );
List<GroupMember>GroupMemberList = new List<GroupMember>([select GroupId,UserOrGroupId from GroupMember]);
List<Split__Share> CsShareList = new list<Split__Share>();
if(!PartnerUsermap.isEmpty()){
for(Split__c cs : trigger.new){
if(PartnerUsermap.containsKey(cs.CreatedById)){
for(GroupMember grpmem : GroupMemberList){
if(grpmem.UserOrGroupId == cs.CreatedById){
Split__Share csshare = new Split__Share (ParentId = cs.id,UserOrGroupId = grpmem.GroupId,AccessLevel = 'Edit');
CsShareList.add(csshare);
}
}
I need to add the following Reps to the sharing logic.. I'm having a hard time figuring out the logic and process. Does anyone have any insight?