function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NevDevNevDev 

autopopulate a lookup field based on the value of another lookup field

I have a custom object called Policies which has a lookup field to Contacts. 

In the Case object, I have created a lookup field to Policies. When a user inputs the Policy number I'd like the Case Contact Lookup field to auto populate with the Contact name related to that policy number. 

Can anyone help me with the code for this? Also, if I introduce a trigger on the Case record, will this have an affect on my email to case function. I had configured a Lookup filter on the Contact lookup field which prevented the email to case from working. So I had to remove it. 
SandhyaSandhya (Salesforce Developers) 
Hi,

Please refer below links for similar discussion you will get some information.

https://success.salesforce.com/answers?id=90630000000hP8IAAU
 
https://developer.salesforce.com/forums/?id=906F00000009F1vIAE
 
http://salesforce.stackexchange.com/questions/79129/auto-populate-fields-based-on-lookup-field-value
 
Hope this helps you!

If this helps you mark it as solved.

Thanks and Regards
Sandhya
NevDevNevDev
Hi Sandhya,

Thanks for that. I had already found those solutions online but they do not help me. I am a beginner when it comes to apex and triggers. I know how to create a trigger but understanding the code is a bit over my head at this stage.