I have a list of report types and I need to find out which reports in my org are using any of those report types. Is there a way to do so instead of manually visiting each report and checking its report type? There are about 14500 reports in my org and I would rather not manually check each one.
Is there a way to query reports based on the report type? I am able to query report names and id's and based on the report id, I can get the report type through the reportMetadata but that isn't ideal since I want to input the report type and fetch reports based on that value.
This is the code I am using for the former.
List<Report> rpt = [select id,name from report limit 10];
for(Integer i=0; i<10; i++) {
Id reportId = rpt[i].id;
// Get the report description
Reports.ReportDescribeResult reportDescription = Reports.ReportManager.describeReport(reportId);
// Get the metadata
Reports.ReportMetadata reportMetadata = reportDescription.getReportMetadata();
// Get the report type
Reports.ReportType rt = reportMetadata.getReportType();
// Output the report's name.
System.debug(i +' Report Name: '+ rpt[i].name);
// Output the localized display name of the report type.
System.debug(i +' Report Type Name: '+ rt.getLabel());
}