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
atulit27atulit27 

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
leftSection
middleSection
rightSection
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];

bob_buzzardbob_buzzard

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.