• chrismart
  • NEWBIE
  • 0 Points
  • Member since 2011

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

Hi,

 

I am relatively new to Apex, and have tried but it appears not very well to create a simple trigger. I simply have 2 custom contact fields (one plain text and one a Lookup field). If the plain text matches a string of text I just need to populate the lookup field with a corresponding ID of a custom object. I have tried all sorts using code samples from the boards, etc. but simply this is what I am trying to achieve:

 

trigger myTrigger on Contact (after insert, after update){
if(Contact.Affiliate__c = '123')
Contact.Affiliate_Source__c = 'a0BQ0000003TAAo';
}

 

I will update contacts using Lead conversion and also mass import using the Apex data loader, so I presume any solution will work on each contact upsert.

 

I know there are more complex functions that include looking up the ID, etc. but I am just trying to get this working in it's most basic form - and would appreciate any help. I am sure it's really simple :)

Hi,

 

I am relatively new to Apex, and have tried but it appears not very well to create a simple trigger. I simply have 2 custom contact fields (one plain text and one a Lookup field). If the plain text matches a string of text I just need to populate the lookup field with a corresponding ID of a custom object. I have tried all sorts using code samples from the boards, etc. but simply this is what I am trying to achieve:

 

trigger myTrigger on Contact (after insert, after update){
if(Contact.Affiliate__c = '123')
Contact.Affiliate_Source__c = 'a0BQ0000003TAAo';
}

 

I will update contacts using Lead conversion and also mass import using the Apex data loader, so I presume any solution will work on each contact upsert.

 

I know there are more complex functions that include looking up the ID, etc. but I am just trying to get this working in it's most basic form - and would appreciate any help. I am sure it's really simple :)