Posts

Showing posts with the label AggregateQueries

Salesforce Fact #938 | SOQL for loop limit error

Image
Have you encountered the error:  System.QueryException: Aggregate query has too many rows for direct assignment, use FOR loop. The error is encountered when SOQL For loop is used on a parent to child SOQL and the child record list contains 200 or more records. To resolve this, we need to run a separate for loop on the child records. Attached are the screenshots.

Salesforce Fact #698 | Aggregate functions in graphql

Image
We can use aggregate functions as well with graphql wire adapter.  In this example, we are getting the related Contact and Opportunity count for an account using the ' totalCount ' variable. Reference:  https://developer.salesforce.com/docs/platform/graphql/guide/aggregate-examples.html Attached is the screenshot.

Salesforce Fact #625 | Limits.getAggregateQueries()

Image
Limits.getAggregateQueries() returns the number of aggregate queries which have been process along with SOQL query statement. Basically, it considers the relationship queries on the child object. Reference:  https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_limits.htm#apex_System_Limits_getAggregateQueries Attached is the screenshot.