Can you check the below trigger logic on Order object. Replace the billingcity field with your field.
trigger OrderTriggerCity on Order (after update) {
Map<id,Order> ordmap= new Map<id,Order>();
for(Order ord:Trigger.new){
Order oldorder= Trigger.oldmap.get(ord.id);
if(ord.BillingCity!=oldorder.BillingCity ){
ordmap.put(ord.AccountId,ord);
}
}
List<Account> acclist=[select id,BillingCity from Account where id in :ordmap.keySet() ];
List<Account> tobeupdate= new List<Account>();
For(Account acc:acclist){
order ordervalue=ordmap.get(acc.id);
acc.billingcity= ordervalue.BillingCity;
tobeupdate.add(acc);
}
update tobeupdate;
}
Let me know if you face any issues.
If this solution helps, Please mark it as best answer.
Can you check the below trigger logic on Order object. Replace the billingcity field with your field.
Let me know if you face any issues.
If this solution helps, Please mark it as best answer.
Thanks,
Try Below Code Please Mark It As Best Asnwer If It Helps
Thank You!