• gv ramesh
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
hi everyone...could u rectify the error.....
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...
hi everyone...could u rectify the error.....
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...