Guest User

Untitled

a guest
Nov 24th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. list<contact> conlist=new list<contact>();
  2. map<id,Account> accountIds=new map<id,account>();
  3.  
  4. for(Account acc:trigger.new)
  5. {
  6. accountIds.put(acc.id, acc);
  7. }
  8. Map<id, Account> accList=new Map<id, Account> ([select id, phone,(select id, phone from contacts) from account where id in:accountIds.keyset()]);
  9.  
  10. for(account a:trigger.new)
  11. {
  12. list<contact> con=accList.get(a.id).contacts;
  13. for(contact cc:con)
  14. {
  15. cc.Phone=a.phone;
  16. conList.add(cc);
  17. }
  18. }
  19. Update conList;
Add Comment
Please, Sign In to add comment