Last Updated on June 1, 2022 by Rakesh Gupta
👉 Check out this article if you want to learn how to Add Report Chart to Lightning Record Page
Reports and dashboards display how you performed in the past and what’s happening at the moment. They are important to driving success and implementation of any CRM project. The information provided by reports and dashboards is especially important in today’s arena, where it’s critical to be proactive, rather than reactive, in your approach. You want to be able to spot trends and act on them immediately.
Business Use case
Higher management in Universal Container wants to use Opportunity trends report chart on a Visualforce Page.
Automation Champion Approach (I-do):
You can use report Report Chart (That is created by using the report builder) in any Visualforce page, with only a single line of code. Report Chart can include dynamic filters, auto-refresh based on an expiration time, and many other options. With this enhancement, all of your most critical Chart and analytics is in the background, wherever you are working.
- Create a Report with Chart. If you don’t to how to do that please go through my article Embedding Charts Anywhere
- Copy the report ID, you can get a report’s ID from the report URL in Salesforce, or request it through the API.
- Now create a Visualforce page and use Visualforce tag <analytics:reportChart> with attribute reportID
<apex:page > <analytics:reportChart reportId="00Ox0000000i8gv" size="small"></analytics:reportChart> </apex:page>
- It will look like below screenshot
You can find more details about <analytics:reportChart> tag by visiting the URL.
Points to Remember
- By default chart’s size is set to Medium. If you to change the size use size attribute and values you can use are Tiny, Small, Medium, Large, Huge.
- The length of time that an embedded chart can cache data is 24 hours.
I want to hear from you!
What is one thing you learned from this post? How do you envision applying this new knowledge in the real world? Feel free to share in the comments below.
5 thoughts on “Embed Report Charts in Visualforce Pages”
is it possible to display salesforce dashboards on a wordpress page?
I have used analytics:reportsChart on my vf page simply by using following code.
where strCaseStatusChart contains the id of the report I need to display over my vf page.
But it gives me the following error
Error : Something has gone wrong. Assertion Failed!: Cannot call EnqueueAction() with a non Action parameter. : false. Please try again.
I am not able to understand what and where went wrong can you please provide some solutions over this error.
Please post your code
When i click on the chart, it takes me to the actual report. Can this be disabled, i don’t my users to see the underlying report.
I think no.