You need to sign in to do that
Don't have an account?
vikramkk
Data from Parent object in to Child object
Hi
I have a custom object with look up to Opportunity. I want some of opportunity field values to be copied in to this custom object fields at the time of first saving the custom object record. How can I achieve this?
Welcome dude, can you please mark it as resolved?
All Answers
You can use before insert event.
You can query all the fields from the opportunity in the trigger using the relationship field .
like if you have Opportunity__c field on the Custom object then yo can do :
List<Opportunity> listOpp = [Select id, Name from Opportunity where Id = Trigger.new[0].Opportunity__c];
and then
Trigger.new[0].Name = listOpp[0].Name;
It worked. Thanks a lot.
Welcome dude, can you please mark it as resolved?