0
  • Using Ananlytics API in Apex with the help of Reports.ReportsManager Object and its methods, I am retrieving data from a report.

  • when I try to run the report using the following :-

Reports.ReportInstance instance = Reports.ReportManager.runAsyncReport(reportId,reportMd, true); System.debug('Asynchronous instance: ' + instance); //Get the Async report instance results Reports.ReportInstance instance1 = Reports.ReportManager.getReportInstance(instance.getId()); Reports.ReportResults results = instance1.getReportResults();

I am getting the following error while loading on Page :

"Content cannot be displayed. The report results aren't available because the instance has not finished running."

| improve this question | | | | |
1

believe you are trying to get the report results before the report is fully run. since you are using runAsyncReport method you have to do kind of polling on the report status and get the results once its run.. this blog from Peter Knolle has code sample on using async http://peterknolle.com/asynchronous-reports-with-the-analytics-api-in-apex/

the other option is to use one of the runReport synchronous methods in the ReportManager class. http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_class_reports_reportmanager.htm

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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