0

As I stated in the headline, I want to be able to run the report and see if It is returning rows or not. (empty or has data)

The background is that I am exporting reports data. So I need to know when the report is empty, in order to avoid the export of the empty report because I end up with HTML data in the report instead of rows. I want to avoid that and make it more user friendly.

I investigated a below result from Reports.ReportResults object and did not found anything that could be used as a solid flag for this case.

Reports.ReportResults results = Reports.ReportManager.runReport(reportId, true);
System.debug(results);

Any help or idea would be appreciated.

  • Have you tried simply calling results.getHasDetailRows()? – Adrian Larson Mar 29 at 22:53
  • Yes, it is returning true even if the report is empty. – Nikola Naumovski Mar 30 at 6:08

Your Answer

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

Browse other questions tagged or ask your own question.