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
Tom Flynn 19Tom Flynn 19 

Setting parent field values on a child record

How can I set values from the parent record in a new child record. If you try doing this with a formula, field update or process builder the values don't show up until after you save the record. Is there any way to access these values so they appear in a new child record before it is saved?

I have seen references to using field updates or process builder to achieve this but I have not seen it work that way.

Thanks,

Tom
Danish HodaDanish Hoda
hi Tom,
You need to update the field as the first method on the before trigger of the child object and then you can take the refrences in your PB or trigger down the line.
Tom Flynn 19Tom Flynn 19
Hi Danish,

Thanks for the reply.  That is not quite what I am asking. If you click 'New' on a related list and an empty record comes up. I would like a couple fields to get default values from the the parent. For example, assume you clicked on New from the Contact related list to add a new contact. What if you wanted the Account.email field value to show up as a default in the Contact email field? 

Thanks again,

Tom
Danish HodaDanish Hoda
Hi Tom,
You can't achieve this through the default functionality, however, you can achieve this by creating a lightning cmp in a  quick action on parent record to create new child records.
Tom Flynn 19Tom Flynn 19
Danish,

Thanks for confirming my suspicion. I want to exhaust all other avenues before heading down that route.

Tom
Danish HodaDanish Hoda
Sure thing, Tom.
Plz let me know by updating the solution here if you come up with other solution. :)