You need to sign in to do that
Don't have an account?
Rick SF Admin
Auto Populate lookup fields based on another lookup field value from the Master object
I have two custom objects; ObjectA__c and ObjectB__c. ObjectA is the master object that has 5 (user) lookup fields. ObjectB is related to ObjectA and has the same 5 (user) lookup fields as ObjectA. When users click "New" to create a new record for ObjectB from the related list of ObjectA, I need the 5 respective lookup fields to auto-poputate with whatever names are listed in the related ObjectA record. Also, if one of the lookup fields in ObjectA are updated, the related ObjectB record should automatically update as well. Please advise. Thanks.
ObjectA ObjectB
Producer__c (lookup): John Smith Producer__c (lookup): John Smith
Manager__c (lookup): Mike Jones Manager__c(lookup): Mike Jones
ObjectA ObjectB
Producer__c (lookup): John Smith Producer__c (lookup): John Smith
Manager__c (lookup): Mike Jones Manager__c(lookup): Mike Jones
Pradeep Singh
- If you have to use the same values as that of Object A on Object B, why don't you use formula field for this.
- If you have to use only lookup fields and you want the field to be populated on clicking save. Then use trigger to update lookups of Object B from Object A. If you want to fill the lookups of child on just clicking new from the relatedList on the Object A, you can ue URL Hacking.
- Now to update lookups on child on updating of lookups on parent Object, you should use trigger for this.
Rick SF Admin
It needs to be a lookup field. And I understand that I need an Apex trigger, but I need help with the apex code.