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
mjohnson-TICmjohnson-TIC 

Retrieve Dashboard Id in Apex in Visualforce Component

Hi All,

 

I have Visualforce Page used in several Dashboards as a component and I was wondering if it were possible to dynamically retrieve the Id of the Dashboard through the Apex controller. Ultimately I would like to run a query within the Apex controller based on the RunningUserId of the Dashboard being viewed, as this VIsuaforce page is being used on several Dashboards. I'd prefer not to create a new Visualforce page for each Dashboard.

Jeff MayJeff May

There is a Dashboard table that you can query.  It might get you started   http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_dashboard.htm

mjohnson-TICmjohnson-TIC

Yes, but the query needs to be dynamic based on which dashboard the Visualforce page is on. Other than extremely ugly javascript workarounds, I can't find any clean way to do this.