+ Start a Discussion
Hemant ReddyHemant Reddy 

Copy the parent record fields data to child record

I wanted to populate the data from Parent record to Child record on record creation or on  parent record edit , if the child record status is not closed . 

e.g : Parent record has customField1 and Child record has customField1,
I wanted to copy the parent record -> customField1 to child record custom field1 if the child record status is not closed .

Will the formula fields will be better option ? OR Need to populsated via triggerHandler ?

Could you please suggest 
Marcos LasoMarcos Laso
It depends on needs.

From parent to child the easiest way is to create one formula for each of the fields you need. In case the children record fields should be edited indentpently after parent changes, this approach will not cover your needs and you would have to stick with some automation process to dump field data (flows, triggers...)

Also if you have many many fields to "copy" or using certain type of field types, you can hit the formula fields limit (more info: https://help.salesforce.com/articleView?id=formula_field_limits.htm&type=5 (https://help.salesforce.com/articleView?id=formula_field_limits.htm&type=5)).

Trigger handler will be a much "future safe" approach, and will also allow you to do things (again, depend on your needs) like grouping by these fields in queries and so on. See this idea (https://trailblazer.salesforce.com/ideaView?id=08730000000HlNtAAK)

Hope it helps. Regards!