• Scott Phillips
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
I am new to attempting apex triggers and just starting out.  I need a VERY SIMPLE, BASIC apex and I've spent hours reading through complex examples and not finding anything for what I need.  Here's my case, could anyone help?

2 Objects:  Contact (standard) and Offer (custom).

The Offer object has a lookup field to the Contact which is selected manually by the user.  
I created a custom lookup relationship field on the Contact called "Offer record."

What I want is an apex that when an Offer is created, the apex will lookup that Contact and populate the Offer record onto the field "Offer record."  

Using abbreviated examples:  So I create record OFR-2468 and using the lookup field choose Contact Joe Smith. I click save on the Offer record.  The apex should go to Joe Smith's Contact record and populate his field "Offer record" with the same offer just created, "OFR-2468."  So you could click back and forth between the two and I could write formula fields on the Contact if I need to.  

I am not concerned if there are multiple records created for the same contact or anything special.  I don't need special criteria or conditions.   Just a reverse lookup to populate that object record and if that is successful I can think about getting more complex.

I appreciate any help you could give.  Thanks in advance.
 
I am new to attempting apex triggers and just starting out.  I need a VERY SIMPLE, BASIC apex and I've spent hours reading through complex examples and not finding anything for what I need.  Here's my case, could anyone help?

2 Objects:  Contact (standard) and Offer (custom).

The Offer object has a lookup field to the Contact which is selected manually by the user.  
I created a custom lookup relationship field on the Contact called "Offer record."

What I want is an apex that when an Offer is created, the apex will lookup that Contact and populate the Offer record onto the field "Offer record."  

Using abbreviated examples:  So I create record OFR-2468 and using the lookup field choose Contact Joe Smith. I click save on the Offer record.  The apex should go to Joe Smith's Contact record and populate his field "Offer record" with the same offer just created, "OFR-2468."  So you could click back and forth between the two and I could write formula fields on the Contact if I need to.  

I am not concerned if there are multiple records created for the same contact or anything special.  I don't need special criteria or conditions.   Just a reverse lookup to populate that object record and if that is successful I can think about getting more complex.

I appreciate any help you could give.  Thanks in advance.