Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list<contact> conlist=new list<contact>();
- map<id,Account> accountIds=new map<id,account>();
- for(Account acc:trigger.new)
- {
- accountIds.put(acc.id, acc);
- }
- Map<id, Account> accList=new Map<id, Account> ([select id, phone,(select id, phone from contacts) from account where id in:accountIds.keyset()]);
- for(account a:trigger.new)
- {
- list<contact> con=accList.get(a.id).contacts;
- for(contact cc:con)
- {
- cc.Phone=a.phone;
- conList.add(cc);
- }
- }
- Update conList;
Add Comment
Please, Sign In to add comment