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 AccountTrigger on Account (after insert, after update) { Set<ID> ids = Trigger.newMap.keySet(); List<Account> Accts = [SELECT Id, Phone, (select ID, AccountID from Contacts) FROM Account WHERE Id in :ids]; List<Contact> ContactstoUpdate = new List<Contact>(); for(Account acc : Accts) { String oldvalue = Trigger.oldMap.get(acc.Id).Phone; String newValue = acc.Phone; if(oldvalue != newValue ) { for(Contact C: acc.Contacts) { C.Phone = Acc.Phone; ContactstoUpdate.add(C); } } } if( !ContactstoUpdate.isEmpty() ) { update ContactstoUpdate; } }