+ Start a Discussion
snippets@sfsnippets@sf 

Opportunity Team Member : Overrides existing team member

I am Using the below line in  a static class method called from the trigger.  it is so unusual why two different records are getting overiden. 
when ownerid is different every time.

insert new OpportunityTeamMember(TeamMemberRole = 'Venue Expert', OpportunityId = op.id, UserId = op.OwnerId);

Did anyone experience this before.
snippets@sfsnippets@sf
But when i executed two different statements in devconsole it gives the perfect values
snippets@sfsnippets@sf
My Guess is it is something to do with "Keep Opportunity Team" checkbox when the owner id is changed. how can i keep this checked in Apex when the owners are changed through the workflows or assgnement rules or by trigger.
snippets@sfsnippets@sf
I Other words how can we "keep Opportunity Team members"  when the Owner is changed. Using Apex Code. ? 

Hope This gives a clear information about my Question

Thanks.