Thursday, August 29, 2019

Find reports used in a report type in salesforce

It is hard to find the reports for a specific report type. To find the reports for a specific report type we need to customize the report and check the report type name.

Apex has provided a inbuilt functionality to find the report type using the report id.

Execute the below code in anonymous execute window.

for(Report report:[SELECT Id,DeveloperName FROM Report Where NamespacePrefix =null]){
 Reports.ReportDescribeResult results = Reports.ReportManager.describeReport(report.Id);
 Reports.ReportMetadata metadata=results.getReportMetadata();
 Reports.ReportType reportType=metadata.getReportType();
 if(reportType.getLabel() == 'Reporttype Name'){
  System.debug(reportType.getLabel() + '--' + report.DeveloperName);
 }
}

3 comments:

  1. Excellent read, Positive site, I have read a few of the articles on your website now, and I really like your style.
    Thanks a million and please keep up the effective work and also get to know about best Salesforce Development Company

    ReplyDelete
  2. Nice Article also get to know about best
    salesforce app development

    ReplyDelete