Embedding Wave dashboard into a visualforce page
Salesforce out of the box supports embedding the einstein analytics dashboards into a custom visualforce pages using <wave:dashboard/> vf tag passing the dashboard id. This tag will create an iframe and dashboard will render inside an iframe. We can also explore and drill down the data in that iframe. we can also set the width, height and wave dashboard properties.
Simple visualforce page to display wave dashboard:
<apex:page>
<wave:dashboard dashboardId="0FK7F000000GDe0WAG" showHeader="false" openLinksInNewWindow="false" showTitle="false" showSharing="false"/>
</apex:page>
Here dashboardId is mandatory and rest of the attributes are optional. To get the dashboard id --> first open the dashboard then view the url, in that one id starts with 0FK that is dashboard id.
showHeader: Show/hide the header of the dashboard.
openLinksInNewWindow: On clicking the dashboard links open that in the same window or new window.
showTitle: Show/hide the title of the dashboard.
showSharing: show/hide the dashboard sharing button.
Dynamically filter the dashboard to Opened record:
Above dashboard shows the all the data. But here we are going to filter the data related to that opened record only.
Ex: we have a dashboard to show the data for all accounts and contacts. I want to see data related to an opened account.
so we will create a visaualforce page to embed dashboard then dynamically add a filter to display related to that record. and add this visualforce page into record view page layout.
Syntax for filter json code:
Syntax for selection json code:
so here we are passing the id of the record to saql query to filter the data.
<apex:page standardController="Account" sidebar="false">
<wave:dashboard dashboardId="0FK7F000000GDe0WAG" showHeader="false" openLinksInNewWindow="false" showTitle="false" showSharing="false" filter="{'datasets':{'AC_Con_Opp':[{'fields':['AccountId'],'filter':{'operator':'matches','values':['{!Account.id}']}}]}}"/>
</apex:page>
COMMENTS