Is there a way to get the SOQL behind a report?

I have a (reasonably) Year on Year analysis summary report that I use in Salesforce and I would like to create this report in SOQL or at least create the SOQL equivelant to return the same results, short of building the SOQL statement myself, I want to know is there a way of finding the SOQL behind any particular report in Salesforce?


There is no way to obtained this, I doubt even Salesforce actually uses SOQL inside the reporting engine. To get a better developer perspective on the report definition you could use the IDE tool to download the report (which uses the Metadata API). I’ve heard of some off platform solutions using this information to parse the report and generate queries SOQL (though its doubtful all report definitions can be supported via SOQL). In the future we will see the advent of the Analytics API (first from REST, then Apex) that will allow an API into the reporting engine!

enter image description here

Source : Link , Question Author : Bartley , Answer Author : Andrew Fawcett

Leave a Comment