+ Start a Discussion

How to edit Reports and Dashboards Programmatically?

I have access to dashboard object. From this object, I am trying to reach the reports included in the dashboard. The dashboard object has three fields
These are of type DashboardComponentSection.

I was hoping to get to the DashboardComponentSection from Dashboard, and then use the components field to get a list of elements of type Dashboard.
From the DashboardComponent we can get to the name of the report,

However the issue I am running into is that Salesforce does not recognize the field leftSection, middleSection and rightSection in the dashboard object. There appears to be no way to get to DashboardComponentSection from the Dashboard object.
The code below gives compilation error -

Dashboard d =[Select Id,title,description ,LeftSection,middleSection,rightSection from Dashboard];


That's correct - you can't get at that sort of information via Apex.  The Metadata API has access to that level of detail for a dashboard.