• Sinka Tinko 1
  • NEWBIE
  • 40 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
public static void OnAfterInsert(List < Opportunity > newOpps) {
List<OpportunityTeamMember> opptList = new List<OpportunityTeamMember>();
for(Opportunity opp : newopps) {
    
    List<Account> acclist = [Select id, name, owner.division from account where id = :opp.account.id ];
    
    for (account a : acclist) {
        if (a.owner.division == 'Payback') {

            opportunityteammember opptm = new opportunityteammember(
            TeamMemberRole = 'Account Manager',
            OpportunityId = opp.id,
            UserId = opp.Ownerid);
            opptList.add(opptm);
            }    
            insert opptList;
        }
    }    
}  
"Can Approve Feed Post" Under Administrative Permissions
Hi,

I have a field on Opportunity (parent_opportunity_owner) that needs to be updated with the parent opportunity owner(opportunity has a lookup relationship with opportunity using opportunity_parent field). I need to achieve this using a trigger. Can anyone help me out. Thanks in advance.
Hi,

Can anyone please help me differentiate between the above meanings. Appreciate your help.

Thanks
public static void OnAfterInsert(List < Opportunity > newOpps) {
List<OpportunityTeamMember> opptList = new List<OpportunityTeamMember>();
for(Opportunity opp : newopps) {
    
    List<Account> acclist = [Select id, name, owner.division from account where id = :opp.account.id ];
    
    for (account a : acclist) {
        if (a.owner.division == 'Payback') {

            opportunityteammember opptm = new opportunityteammember(
            TeamMemberRole = 'Account Manager',
            OpportunityId = opp.id,
            UserId = opp.Ownerid);
            opptList.add(opptm);
            }    
            insert opptList;
        }
    }    
}  
"Can Approve Feed Post" Under Administrative Permissions
Hi,

I have a field on Opportunity (parent_opportunity_owner) that needs to be updated with the parent opportunity owner(opportunity has a lookup relationship with opportunity using opportunity_parent field). I need to achieve this using a trigger. Can anyone help me out. Thanks in advance.