+ Start a Discussion

Automatically add Opportunity Team Member to the Opportunity

I am looking for help with automatically adding a person to an opportunity team.  We have a custom formula field "Lead Sales Engineer Assinged" that is populated with a Sales Engineer's name when a certain primary site (another custom picklist field) is selected.   What I am looking to do is to automatically add that person to the opportunity team when the opportunity is created and assign them with a team role of Lead Sales Engineer.  Any help will be greatly appriciated.  Also,  as I am new to Apex, if anyone can provide me with sample code that would be awesome :)!!
VikashVikash (Salesforce Developers) 

Please follow this link

Hope this helps you.


Hi Vikash,

Thanks for the link.  I am still a little confused as to how this trigger can help me out, since this trigger copies the account team members over to opportunity team members...if you can explain why I would greatly appreciate it.

In my case, when a opportunity is created, the sales rep has to complete several required fields; one of which is Primary Site.  When they click save, the primary site they selected populates another field (Lead Sales Engineer Assigned) on the opportunity based on a custom object.  The name in that field, I want to add to the Opportunity Team with a role of "Lead Sales Engineer".  In addition, there may or may not be members on the account team and even if there is, at this point in time, we need to make sure that the Lead Sales Engineer in the opportunity team is the same person that is populated in the Lead Sales Engineer Assigned field.

Once again, any help is much appreciated!