You need to sign in to do that
Don't have an account?
anji punyamanthula
I want to invoke update Class of Map in trigger, can any one let me know how to do that
I want to invoke update Class of Map in trigger, can any one let me know how to do I'm attaching my controller below
public class Map_Acc_Con_upp_Ex1 {
public Static void Afterupdate(Map<Id,Account> accs){
List<Account> accounts=accs.values();
Set<Id> acids=accs.keyset();
List<Contact> contacts=new List<Contact>();
List<contact> cons=[select LastName,phone,AccountId from Contact where Accountid in:acids];
for(Contact c:cons){
c.phone=c.Account.Phone;
contacts.add(c);
}
update contacts;
}
}
public class Map_Acc_Con_upp_Ex1 {
public Static void Afterupdate(Map<Id,Account> accs){
List<Account> accounts=accs.values();
Set<Id> acids=accs.keyset();
List<Contact> contacts=new List<Contact>();
List<contact> cons=[select LastName,phone,AccountId from Contact where Accountid in:acids];
for(Contact c:cons){
c.phone=c.Account.Phone;
contacts.add(c);
}
update contacts;
}
}
Class is here