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

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 =, UserId = op.OwnerId);

Did anyone experience this before.
But when i executed two different statements in devconsole it gives the perfect values
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.
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