You need to sign in to do that
Don't have an account?
Dave Shulman
Retrieving child records to list from parent record
Looking back at some of the existing code in my org someone used something like this to get child records onto a list
for(Account acc : accounts){ List<Sales_data__c> salesDatas = acc.Sales_data1__r;I had no idea you were able to do it like this without a query, but now when i try to repurpose a version of this somewhere else, it isnt pulling working when everything is virtually the same? Please advise thanks!
accounts = [select id,name, (select xxxx from Sales_data1__r) from Account where ........];
Basically, it pulls all sales_data1__c records associated to the correspoding accounts by matching account id with Account__c lookup (or master-detail)_ relationship field value.