• EricG102938
  • NEWBIE
  • 0 Points
  • Member since 2010

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

Gang,

How is this supposed to be written, I know I need to bulkify, buts its not working for me:


trigger Contact_BeforeInsertBeforeUpdate on Contact (before insert, before update) {
 for(Contact c: Trigger.new){
  if(c.Relo_Contact_Name__c!=null){
  String ContactId=c.Id;
   for(Related_Contact__c rc:[select Id,ContactId__c,Relo_Contacts__c from Related_Contact__c where ContactId__c = :ContactId]) {
   rc.Relo_Contacts__c=c.Relo_Contact_Name__c;
   update rc;
   }
  }
 }
}

Gang,

How is this supposed to be written, I know I need to bulkify, buts its not working for me:


trigger Contact_BeforeInsertBeforeUpdate on Contact (before insert, before update) {
 for(Contact c: Trigger.new){
  if(c.Relo_Contact_Name__c!=null){
  String ContactId=c.Id;
   for(Related_Contact__c rc:[select Id,ContactId__c,Relo_Contacts__c from Related_Contact__c where ContactId__c = :ContactId]) {
   rc.Relo_Contacts__c=c.Relo_Contact_Name__c;
   update rc;
   }
  }
 }
}