You need to sign in to do that
Don't have an account?
Greg Coogan
Visualforce page where users can select a Dashboard and then click a button to export the Dashboard as a PDF
I've been looking for a solution to allow users to export dashboards as a PDF. I tried a POC with embedding a dashboard with on a VF page, but no luck. I've seen guides on how to embed specific components of a dashboard using the image servlet, but I'm looking for the whole dashboard. Rendering as PDF didn't work when I tried to use the ID of the dashboard in an iFrame.
The ideal solution would be a button to export the dashboard when viewing the dashboard. However, I cannot add custom buttons to a the dashboard page. Therefore, I have thought of this:
1. Visualforce page with a dropdown of dashboards
2. Users choose a dashboard, and click a button on the Visualforce page that triggers a download of that dashboard
Since I had no success with the dashboard in iFrame, I am wondering if this is even possible. How would I accomplish this?
The ideal solution would be a button to export the dashboard when viewing the dashboard. However, I cannot add custom buttons to a the dashboard page. Therefore, I have thought of this:
1. Visualforce page with a dropdown of dashboards
2. Users choose a dashboard, and click a button on the Visualforce page that triggers a download of that dashboard
Since I had no success with the dashboard in iFrame, I am wondering if this is even possible. How would I accomplish this?
As per my knowledge, salesforce will store dashboard as Image. To Solve your problem you need to do little try ( I never tried it )
Use Dashboard REST API describe to fetch Dashboard metadata and form the Image URL Dynamically.
For Testing , Go to any Dashboard --> Right Click --> Copy Image URl to see the DB image
You can use the Image in PDF.
Thanks ,
Raj
I couldn't follow your testing steps, if you were referring to browsing within Salesforce itself. I don't have that option when right clicking on the dashboard. If I right click on a chart within a dashboard, I can copy the Image URL.
I used workbench REST explorer and navigated to the metadata on a particulalr dashboard. The URI provided was in this format:
/services/data/v39.0/sobjects/Dashboard/{Dashboard ID}
Also found this: https://resources.docs.salesforce.com/rel1/doc/en-us/static/pdf/SF_Reports_and_Dashboards_Rest_API_web.pdf
And this: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_dashboard.htm
If you are sure this is possible, can you try your solution? Remember, this is for the entire dashboard, not just one of the chart components on the dashboard.
You are correct. On dashboard image right click to get the chart. you can use it as an image to export to PDF.
Let me try if I have any code ready to share with you.