
2 件の回答

Hi,I've gone through your requirement and you can find the apex code for mapping account and contact below:List<Account> allaccounts=new List<Account>([select id,Name from Account limit 1000]);List<Contact> allcontacts=new List<Contact>([select id,Name,Email,AccountId from Contact where AccountID IN:allaccounts]); for(Contact contacts:contactsList) { if(ConAccMap.containsKey(contacts.AccountId)) { ConAccMap.get(contacts.AccountId).add(contacts); } else { ConAccMap.put(contacts.AccountId,new list<contact>{contacts}); ConAccMap.get(contacts.AccountId).add(contacts); } }I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.Thanks and Regards,Deepali Kulshresthawww.kdeepali.com