You need to sign in to do that
Don't have an account?
@anilbathula@
Lookup field to be update on contact
Hi guys,
please help me in this case.
I am working with contact object .There is a lookup field called spouse on to contact.(self lookup).
Here if a contact record name='Daniel'.
And spouse in the record of daniel is 'Mary'.
if i click mary lookup feild the daniel should be the spouse in the mary record.
it means the lookup value should change vice versa.
How can i achieve this with trigger plz help me with the trigger.
Thanks
Anil.B
Hi,
You need to create a static class for preventing recursive trigger.
code will be like this :
Please make it bulk trigger, if you are planning to work on bulk records.
All Answers
A simple trigger should do it.
Hi scott,
Thanks for ur response.
This trigger is not saving its throughing an error at line 6.
Error: Compile Error: Field is not writeable: Contact.Id at line 6 column 13.
if i comment line 6 its saving and on record its throughing error as:-
first error: MISSING_ARGUMENT, Id not specified in an update call: []: Trigger.MatchSpouse: line 11, column 1.
Thanks
Anil.B
My bad. Try this one.
Above code is Not working properly.
Hi,
You need to create a static class for preventing recursive trigger.
code will be like this :
Please make it bulk trigger, if you are planning to work on bulk records.
How so? I looks good on my sandbox.
Hmm... good point. With the divorce rate as high at it is, you probably will have a lot of people changing their spouses. ;-)
:-) .
Thanks Scott and Rohit u helped me a lot thank u very much guys.
Thanks
Anil.B