You need to sign in to do that
Don't have an account?

HI , i am phasing this issue variable doesnot exist on trigger
HI,
i am phasing this issue variable doesnot exist.
trigger updatephonecontact on Account (after update)
{
for(account acc : trigger.new)
{
list<contact> listcon= [select phone from contact where accountid=:acc.id];
}
/for(Contact ct : listcon)
{
ct.phone=acc.phone ;// i got error at his line can ypo pls help me
}
update listcon;
}
i am phasing this issue variable doesnot exist.
trigger updatephonecontact on Account (after update)
{
for(account acc : trigger.new)
{
list<contact> listcon= [select phone from contact where accountid=:acc.id];
}
/for(Contact ct : listcon)
{
ct.phone=acc.phone ;// i got error at his line can ypo pls help me
}
update listcon;
}
This is my requirement,
on Account object .it contain records and child related list contacts. Where account phone number and contact phone number are same. let suppose any point of time I would like to update to the phone number of Account at the same time I would like to update it’s associated contact phone also .
Regadrds,
viswa
Please go through the sample code in below link
http://salesforceglobe4u.blogspot.in/2015/12/update-all-contacts-phone-number-with.html
Let me know in case of any issues.
please see some best practices here.https://developer.salesforce.com/page/Apex_Code_Best_Practices
Thanks
hpm