Salesforce Dashboard Rotation and Refresh with Tampermonkey

13 Jan

Have you ever wanted to rotate through a series of Salesforce dashboards and have them auto refresh? There are multiple questions on the success community and other forums requesting exactly this. The easiest way to rotate through dashboards is to use a browser plugin that switches between pages. However, data in the dashboards can only be scheduled to refresh once per day. A more frequent refresh requires a user to click the refresh button on the dashboard page.

Enter the Tampermonkey browser plugin and a little Javascript. Tampermonkey is a plugin that allows you to execute Javascript code when a page loads in the browser. To solve the problem of getting a refreshed rotation of dashboards, I wrote a little Javascript code that will redirect to a series of dashboard URLs and automatically click the refresh button without user interaction.

  1. Install the Tampermonkey plugin to Chrome or Firefox.
  2. Create a new Tampermonkey script and paste in the code below.
  3. Update the URLs from “https://na1.salesforce.com” to reflect your instance’s URL.
  4. Update the list of dashboard record ids in the code. Navigate to the dashboard page, and you will find the record id in the location bar of the browser.
  5. Navigate to a dashboard page, add the URL parameter “&rotate=true” to the end, and press enter.