You need to sign in to do that
Don't have an account?
ram_dev
adding account owner and territory owner to the opportunityTeam
hi,
could some one provide the apex code for trigger. that automatically pulls the account owner and territory owner to the sales team.
hi,
here is the code i wrote, but got error "invalid field integrity''. Am not sure how come we add at a time account owner and territory owner to the opportunity Team.
trigger optyteam Opportunity (After Insert,After Update)
{
List<id> AccId=new List<Id>();
List<OpportunityTeamMember> oppMembers=new List<OpportunityTeamMember> ();
for (Opportunity opp : Trigger.new)
{
OpportunityTeamMember otm=new OpportunityTeamMember ();
otm.Userid=opp.Accountid;
otm.opportunityid=opp.id;
otm.TeamMemberRole='abs';
oppMembers.add(otm);
}
if(oppMembers.size() > 0)
{
insert oppMembers;
}
}
can anyone help me from this.
Here is the problem
How can you assign AccountId to User Lookup ?
Please assign proper USerId according to your business logic.