Trying to get Account field "Phone" to populate "Main Office Phone" on Contact upon creation of a new contact. This is some copied code that I tried to use as a sample, but I have a Variable Does Not Exist error on listConForPhoneUpdate
. Can anyone see my possible error(s)?
trigger ContactPhone on Account (before update)
{
for (Account acc : Trigger.New)
{
List<Contact> listConForPhoneUpdate = [Select Phone from Contact
where Phone != null and AccountID =: acc.id];
for(Contact con : listConForPhoneUpdate)
con.Phone = acc.Phone;
}
update listConForPhoneUpdate;
}