
2 个回答
Hi Charan, Please find the following solution which is tested -
------------Thanks,Srinivas- Please mark as solution if your problem is resolved.trigger ContactTrigger on Contact (before insert, before update) {
Set<Id> accIds = new Set<Id>();
for(Contact con : trigger.new) {
accIds.add(con.AccountId);
}
Map<Id,Account> accountMap = new Map<Id,Account>(
[select Phone from Account where id in: accIds]
);
for(Contact con : trigger.new) {
con.phone = accountMap.get(con.accountId).Phone;
}
}