Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
List Asynchronous Runs of a Report
The instance list is sorted by the date and time when the report was run. Report results are stored for a rolling 24-hour period. During this time, based on your user access level, you can access results for each instance of the report that was run.
Example
You can get the instance list by calling the ReportManager.getReportInstances method. For example:
1// Get the report ID
2List <Report> reportList = [SELECT Id,DeveloperName FROM Report where
3 DeveloperName = 'Closed_Sales_This_Quarter'];
4String reportId = (String)reportList.get(0).get('Id');
5
6// Run a report asynchronously
7Reports.ReportInstance instance = Reports.ReportManager.runAsyncReport(reportId, true);
8System.debug('List of asynchronous runs: ' +
9 Reports.ReportManager.getReportInstances(reportId));