You need to sign in to do that
Don't have an account?

Trigger to populate Lookup field on Contact from custom object
Hi.
I am new to apex and I need some help with a trigger. I've looked around online and can't even piece together some code to test it, so I am asking for your help.
I have a lookup field on the contact object named Sage Caller (which is a user object lookup field), I need this field to be updated when the field from my custom object Scorecard named Caller is filled out. (Caller is a lookup field to the user object).
Basically, when I create a Scorecard record and fill out the Caller field, whomever is in that field I need that same user to be updated into the Sage Caller field on the contact.
I can't use a workflow because it is just a lookup relationship and not master detail.
Thanks in advance!
I am new to apex and I need some help with a trigger. I've looked around online and can't even piece together some code to test it, so I am asking for your help.
I have a lookup field on the contact object named Sage Caller (which is a user object lookup field), I need this field to be updated when the field from my custom object Scorecard named Caller is filled out. (Caller is a lookup field to the user object).
Basically, when I create a Scorecard record and fill out the Caller field, whomever is in that field I need that same user to be updated into the Sage Caller field on the contact.
I can't use a workflow because it is just a lookup relationship and not master detail.
Thanks in advance!
Just add below line after 2nd line :
Thanks,
Vatsal
All Answers
can you please tell what is the relation between Score Card & Contact Object? Because you are creating score card record and updating contact..So which contact do you want to update?
Thanks,
Vatsal
There is a field on the Scorecard object called Primary Training Contact and that is a Contact lookup field. That would be the contact record to update Sage Caller on.
I hope that helps.
Thank you!
If this solves your problem, kindly mark it as the best answer..:)
Thanks,
Vatsal
It is giving me the error: Line 22 Variable does not exist: conMap
error: Line 20 Variable does not exist: conMap
Just add below line after 2nd line :
Thanks,
Vatsal