1

Any idea how to convert a query into a string?

3
  • 2
    P.S. no need to copy the list, just query and return, e.g. return (List<AggregateResult>)Database.query(query);
    – sfdcfox
    Jan 20, 2022 at 15:34
  • 1
    You have an extra single quote on the From Fee line Jan 20, 2022 at 15:38
  • Why did you remove most of your question? The idea of this site is that others can find your question and learn from it. Removing most of your question makes that impossible
    – Kasper
    Jan 23, 2022 at 2:40

1 Answer 1

5

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!

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.