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
You can do something like this to copy parent fields to child fields:
You can add more fields which you want to copy in the trigger