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
Pathak 1Pathak 1 

Write a trigger on child object, where parent is an external object, to copy parent record fields to child

Head In CloudHead In Cloud
Hi,
You can do something like this to copy parent fields to child fields:
trigger CopyAccountPhoneToContactPhones on Account (after inseet, after update) {
    Map<Id, String> m = new Map<Id, String>();
    list<contact> conlist = new list<contact>();
    for (contact a : [select id, phone, accountid, account.phone from contact where id in: trigger.new]}) {
        if(a.accountid != null){
        	a.phone = a.account.phone;
        	conlist.add(a);
        }

    }
    update conlist;
}

You can add more fields which you want to copy in the trigger