I have an account record having name 'POC', This account has 5000 contacts.
Now I am querying in Execute anonymous
1.
List<Account> accounts = [Select Id, Name, (Select Id, Name From Contacts limit 5000) From Account Where Name= 'POC'];
System.debug('Contact Size::' + accounts[0].Contacts.size());
I got result in debug Contact Size::5000
Now I am modifying query(Adding Description field)
2.
List<Account> accounts = [Select Id, Name, (Select Id, Name, Description From Contacts limit 5000) From Account Where Name= 'POC'];
System.debug('Contact Size::' + accounts[0].Contacts.size());
Getting an error :
FATAL_ERROR|System.QueryException: Aggregate query has too many rows for direct assignment, use FOR loop
This query is working upto 999 contacts.
Contacts
as well? Sounds like a bug, perhaps..size()
on the resultant data: help.salesforce.com/…