You need to sign in to do that
Don't have an account?
@GM
Invalid initial type LIST;Class__c; for MAP;Id,LIST;Student__c;
Please Suggest,
Here Class__c is Parent
and Student__c is Child
Child Relationship Name is Students,
Map<Id,List<Student__c>> mapName=new Map<Id,List<Student__c>>([Select Id,(select Name from Students__r) from Class__c]);
Query is working fine in developer console but in apex class, getting error for the above statement.
Regards,
GM
Here Class__c is Parent
and Student__c is Child
Child Relationship Name is Students,
Map<Id,List<Student__c>> mapName=new Map<Id,List<Student__c>>([Select Id,(select Name from Students__r) from Class__c]);
Query is working fine in developer console but in apex class, getting error for the above statement.
Regards,
GM
bob_buzzard
Your query returns a list of Class__c object records, which is suitable for storing in a type Map<Id, Class__c>. If you are trying to store a list of student records keyed by class id, you'd need the following: