Any idea how to convert a query into a string?
1 Answer
Instead of for (List<AggregateResult> agg: query)
you should have for (List<AggregateResult> agg: Database.query(query))
.
You can find additional detail regarding Dynamic SOQL here.
Best regards!
return (List<AggregateResult>)Database.query(query);
From Fee
line