How do you know the label of a column in the report?

I use getReportMetadata() and after I use getDetailColumns(), but this is list of API Name of columns in the report. I want discover name this columns. Can you help me ?


// Get the report ID
List <Report> reportList = [SELECT Id,DeveloperName FROM Report where 
DeveloperName = 'abc_Report'];
String reportId = (String)reportList.get(0).get('Id');

// Run a report
Reports.ReportResults results = Reports.ReportManager.runReport(reportId);
// Get the report extended metadata
Reports.ReportExtendedMetadata rmd =   results.getReportExtendedMetadata();

// Get detail columns from extended metadata
Map<String,Reports.DetailColumn> colMap = rmd.getDetailColumnInfo();

for(String key : colMap.KeySet()){
System.debug('Key=' + Key + ' label=' + colMap.get(key).getLabel());

For more information Refer ReportExtendedMetadata Class

Source : Link , Question Author : kerov , Answer Author : Santanu Boral

Leave a Comment