You need to sign in to do that
Don't have an account?
Accessing filter criteria of Salesforce Report programmatically
hi
I want to check programatically what filters are applied for a salesforce report. Given that i ve salesforce id of a particular report how can i find what filters are applied?
I saw (from http://www.salesforce.com/us/developer/docs/api_meta/Content/meta_report.htm#ReportFilterItem) that "ReportFilterItem" contains all filtering criteria. But i am not sure of how to access it. Because its not available as a field which can be queriable using soql.
it has to be dealt somehow with REST or SOAP or Metadata APIs .
I ve gone through all conversations in http://boards.developerforce.com/t5/Apex-Code-Development/Is-it-possible-to-call-Metadata-API-from-Apex-code-Getting-Error/m-p/119441#M14113 which eventually ended that we can access metadata api using retrieve() .. but it ll be returned in zip format which is difficult/ not possible to deal with..
Can any body help me with this?
thanks
hope there is
I really a solution for this? Hope there is one.
// Get the report ID
List <Report> reportList = [SELECT Id,DeveloperName FROM Report where
DeveloperName = 'Company_owned_Independent_sites'];
String reportId = (String)reportList.get(0).get('Id');
// Run a report
Reports.ReportResults results = Reports.ReportManager.runReport(reportId);
// Get the report metadata
Reports.ReportMetadata rm = results.getReportMetadata();
for(Reports.ReportFilter rf : rm.getreportFilters()){
system.debug('---col value---'+rf.getcolumn());
system.debug('---col value---'+rf.getValue());
}