whats wrong with this code? I am trying to loop through a list of contacts and for some reason it doesnt like the var con. I know its something very simple that i am missing, which makes me feel i shouldnt be working on a sunday
This is the SOQL i am using on the batch process to fetch the records
SELECT Id, name, (SELECT Id,accountid, Name,email FROM Contacts order by createddate asc) FROM Account
map<Id,List<contact>> mapContacts = new map<Id,List<contact>>();
for(sObject s : objectBatch)
{
Account a = (Account)s;
mapContacts.put(a.id,a.contacts);
}
for(Id accid : mapContacts.keyset())
{
List<contact> contactList = new List<contact>();
contactList = mapContacts.get(accid);
system.debug(contactList);
for(Contact con : contactList);
{
String key ='';
contacts.clear();
system.debug(con); // Variable does not exist: con
}
}