You need to sign in to do that
Don't have an account?
gv ramesh
getting error while updating contact and account using trigger...
hi everyone...could u rectify the error.....
thanks inadvance...
trigger conchangecity on Contact (after update) { if(trigger.isafter){ if(trigger.isupdate){ set<id>conids=new set<id>(); list<account> acclst=new list<account>(); for(contact con:trigger.new){ if(con.mailingcity!=trigger.oldmap.get(con.accountid).mailingcity && con.mailingcity!=null) conids.add(con.accountid); } contact con=new contact(); for(account acc:[select id,billingcity from account where id in:conids]){ acc.billingcity=trigger.newmap.get(con.accountid).mailingcity; acclst.add(acc); } update acclst; } } }
thanks inadvance...
What is Error?
Below is the code which updates the accounts mailing city when the related contacts mailing city is updated.
Hope this might help you
Thanks
Just replace the line no 7 as
Hope this solves.
Thanks