• podger
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

I am trying to create a trigger that will populate a custom lookup field (Opportunity1_c) to Opportunities on Opp Team  with the value of the Opp that the Team Member is being added onto.

 

The reason being that I want to run workflows etc off the vlaues from the parent Opp but it cant be got to by standard methods - can this be done with a trigger?

 

 I have started to try and code one but my skills are not the best. Any help would be appreciated 

 

Here is what I have come up with so far 

 

trigger Opp_Team on OpportunityTeamMember (before insert, before update) {

Map <String, Opportunity > OppMap = new Map <String, Opportunity>();
for (Opportunity p : [SELECT Id, Name from Opportunity])
{
OppMap.put(p.Name,p);
}

for (OpportunityTeamMember a: Trigger.new)
{
a.Opportunity1__c = OppMap.get(Opportunity);
}


}

  • November 26, 2013
  • Like
  • 0

I am trying to create a trigger that will populate a custom lookup field (Opportunity1_c) to Opportunities on Opp Team  with the value of the Opp that the Team Member is being added onto.

 

The reason being that I want to run workflows etc off the vlaues from the parent Opp but it cant be got to by standard methods - can this be done with a trigger?

 

 I have started to try and code one but my skills are not the best. Any help would be appreciated 

 

Here is what I have come up with so far 

 

trigger Opp_Team on OpportunityTeamMember (before insert, before update) {

Map <String, Opportunity > OppMap = new Map <String, Opportunity>();
for (Opportunity p : [SELECT Id, Name from Opportunity])
{
OppMap.put(p.Name,p);
}

for (OpportunityTeamMember a: Trigger.new)
{
a.Opportunity1__c = OppMap.get(Opportunity);
}


}

  • November 26, 2013
  • Like
  • 0