Skip to main content
added 191 characters in body
Source Link
Santanu Boral
  • 36.2k
  • 8
  • 45
  • 72
// 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

// 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());
}  
// 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

Post Undeleted by Santanu Boral
added 98 characters in body
Source Link
Santanu Boral
  • 36.2k
  • 8
  • 45
  • 72

You can use Schema.SObjectField to retrieve the field key and label

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

// fieldMapRun a report
Reports.ReportResults results = SchemaReports.SObjectTypeReportManager.AccountrunReport(reportId);
// Get the report extended metadata
Reports.fieldsReportExtendedMetadata rmd =   results.getMapgetReportExtendedMetadata();

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

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

You can compare the key which you have retrieve from getDetailColumns() method and get the label by using above code.

Sobject.Account is kind of placeholder, you can use any other objects according to your requirements.

You can use Schema.SObjectField to retrieve the field key and label

Map<String, Schema.SObjectField> fieldMap = Schema.SObjectType.Account.fields.getMap();

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

You can compare the key which you have retrieve from getDetailColumns() method and get the label by using above code.

Sobject.Account is kind of placeholder, you can use any other objects according to your requirements.

// 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());
}  
Post Deleted by Santanu Boral
Source Link
Santanu Boral
  • 36.2k
  • 8
  • 45
  • 72

You can use Schema.SObjectField to retrieve the field key and label

Map<String, Schema.SObjectField> fieldMap = Schema.SObjectType.Account.fields.getMap();

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

You can compare the key which you have retrieve from getDetailColumns() method and get the label by using above code.

Sobject.Account is kind of placeholder, you can use any other objects according to your requirements.