function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Is report metadata available via Apex?

Is it possible to read the metadata of a report in Apex. I'm interested in being able to get the fields and conditions that have been assigned to a report programitcally.





yes the report metadata is available via metadata api. You can get the filter criteria and many other things from the extracted metadata.


Thanks. But isn't the metadata api for external applications to consume? How would I access the metadata api from within an Apex class?


The correct answer here is "no." You can not access the Metadata API through Apex Code, primarily because the API is asynchronous, while Apex Code is synchronous, and it returns a compressed file, and Apex Code is not well suited to handling binary data. There's too many limitations in Apex Code to even attempt this. Your best choice would be to request and unpack the data using JavaScript in a Visualforce page. Even that would not be a trivial task, but it would be conceivable, at least.


sorry didnt noticed the apex part... :P