Live Dashboards using Analytics API — Summer’14

In 50 lines of code!

Arun V
Salesforce Analytics
2 min readFeb 4, 2014

--

One of the easiest ways to empower your Sales team is to put a live dashboard on HDTVs. Not only does everybody on the team know where they stand but can also see how they’re doing relative to their peers. This kind of a live dashboard is valuable in non-sales environments like Call Centers or Performance monitoring groups.

“Dashboards in the Analytics API”

In Spring’14, Salesforce is adding Dashboards to the Analytics API. Similar to Reports, Dashboard will be available in the Analytics REST API under the URL end-point: /services/data/v30.0/analytics/dashboards/. The API supports the 3 key operations — fetch, refresh and poll.

Setup your Salesforce Dashboard

Let’s start with a your Salesforce dashboard, the one below has five key-metrics.

Define your 4-column DashboardUI

D3 is one my favourite charting solutions. So in this example we will define a custom UI that has a 4 columns of D3 charts. Since this is a completely custom UI that I get to define, I am no longer limited to the standard Salesforce 3 column Dashboard UI.

Turn it ON!

The next step after defining your layout, is to plug-in the data from the API into D3 charts. This is a very simple and straight forward process, look at the example here: https://github.com/arun-sfdc/Analytics-API/blob/master/ngSfdcChart.js

The final step is to make your Dashboard “LIVE”. In order to achieve this, all you need to do is to turn on auto-refresh. In this example, we set the dashboard to auto-refresh every 6 minutes using standard Javascript methods.

Complete self-contained example: https://github.com/arun-sfdc/Analytics-API/blob/master/customDashboard.page

There you have it, Live Salesforce Dashboards with completely custom UI in under 50 lines of code!

--

--