You need to sign in to do that
Don't have an account?
SFDC 1904
Aggregate query has too many rows for direct assignment, use FOR loop. This exception is sometimes thrown when accessing a large set of child records (200 or more) of a retrieved sObject
We are getting this exception if number child records are more than 30.
What should we do?
What should we do?
I found the below link which states we get this error when we are trying to use an aggregate function (like COUNT) on a query that has too many rows.
Link: https://help.salesforce.com/articleView?id=000323566&language=en_US&type=1&mode=1
Kindly let me know if this helps and please close the thread by marking a best answer so that it would be useful for others in the future and also it would be helpful in keeping the community clean.
Regards,
Anutej
I assume you are using a SOQL Query with a Nested query as result for a FOR loop. for e.g.
If an Account has too many contacts it will cause the mentioned error.
To resolve this error use below code:
If problem still persists please let me. If it helped please mark this as the best answer.
Thanks and Regard
Ayush Sharma