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

Populating List of Custom Child Objects from Query
I am trying to populate a list of custom child objects through a query. The following code does not work
List<child__c> childlist; childlist=database.query('SELECT child__r.last_name__c, child__r.first_name__c FROM parent__c');
Something like this:
List<Child__c> children_for_parent = parentList.get(0).Children__r; // children for first parent
Here the plural name for child in my setup is children - hence the children__r relationship name. You would probably put in a loop here.
Hope this is what you are after.