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

error is coming in this code
trigger accountcontact on Account (after insert) {
list<id> AccountId= new list<Id>();
for(contact con:Trigger.new){
accountId.add(con.AccountId);
}
map<Id, Account>AccountMap= New map<Id, Account>([Select id,name,myruchika__client_contact__c from Account where Id IN:accountId]);
list<account> updateaccountlist= new list<Account>();
for(contact con :trigger.new){
if(Accountmap !=null&& accountmap.size()>0) {
for(Account acc: Accountmap) {
acc.myruchika__client_contact__c=con.Id;
updateAccountlist.add(acc);
}
}
}
if(updateAccountList !=null && updateaccountlist.size()>0)
update updateAccountlist;
}
error=loop varible must be account type???
list<id> AccountId= new list<Id>();
for(contact con:Trigger.new){
accountId.add(con.AccountId);
}
map<Id, Account>AccountMap= New map<Id, Account>([Select id,name,myruchika__client_contact__c from Account where Id IN:accountId]);
list<account> updateaccountlist= new list<Account>();
for(contact con :trigger.new){
if(Accountmap !=null&& accountmap.size()>0) {
for(Account acc: Accountmap) {
acc.myruchika__client_contact__c=con.Id;
updateAccountlist.add(acc);
}
}
}
if(updateAccountList !=null && updateaccountlist.size()>0)
update updateAccountlist;
}
error=loop varible must be account type???
Infact the nested for loop is not required