function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
trigger phupdate on Contact (after insert,after update) { List<account> li=new list<Account>(); List<Id> ids = new List<Id>(); for(Contact c: trigger.new){ if(c.AccountId != null){ ids.add(c.AccountId); } } Map<Id, Account> accountMap = new Map<Id, Account>([Select Id, Phone From Account Where Id In :ids]); for(Contact c: trigger.new) { Account a = accountMap.get(c.AccountId); if(a != null) { a.Phone= c.phone; li.add(a); } } update li; }
trigger updateAccountPhone on Contact(before insert,before update){ Set<id> accIdSet = new Set<Id>(); for(Contact con:trigger.new){ if(con.accountId<>null){ accIdSet.add(con.accountId); } } List<Account> accList = [Select id,phone from Account where id in:accIdSet]; if(accList<>null && accList.size()>0){ for(Contact con:trigger.new){ for(Account acc:accList){ if(con.accountId=acc.id){ con.phone = acc.phone; break; } } } } }
trigger updateAccountPhone on Contact(before insert,before update){ Set<id> accIdSet = new Set<Id>(); for(Contact con:trigger.new){ if(con.accountId<>null){ accIdSet.add(con.accountId); } } List<Account> accList = [Select id,phone from Account where id in:accIdSet]; if(accList<>null && accList.size()>0){ for(Contact con:trigger.new){ for(Account acc:accList){ if(con.accountId==acc.id){ con.phone = acc.phone; break; } } } } }
use below contact trigger let me inform if it helps you
Thanks
All Answers
Here is your trigger code:
Please let me know how this works for you, mark this as Solved if this helps you so that others can view it as a proper solution.
Thanks,
Apoorv
Please make sure you are using the exact same code provided below:
Please let me know how this works for you, mark this as Solved if this helps you so that others can view it as a proper solution.
Thanks,
Apoorv
use below contact trigger let me inform if it helps you
Thanks