Skip to content

Instantly share code, notes, and snippets.

@abh1nav
Created December 19, 2016 17:22
Show Gist options
  • Save abh1nav/e8c5dec056cdbc2397e8e71ea6757f91 to your computer and use it in GitHub Desktop.
Save abh1nav/e8c5dec056cdbc2397e8e71ea6757f91 to your computer and use it in GitHub Desktop.
Salesforce Dashboard Auto-Refresh
// ==UserScript==
// @name Refresh Salesforce Dashboard
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Sales target dashboard refresher
// @author Abhinav Ajgaonkar
// @match https://na22.lightning.force.com/desktopDashboards/dashboardApp.app*
// @grant none
// @require https://code.jquery.com/jquery-3.1.1.min.js
// ==/UserScript==
(function() {
'use strict';
const refreshMins = 60;
//
// Compute the interval based on the refreshMins variable
const interval = refreshMins * 60 * 1000;
console.log(`[CrowdRiff] Starting auto-refresher - will refresh every ${refreshMins} minutes`);
setInterval(() => {
console.log('[CrowdRiff] Refreshing dashboard');
$("span:contains(Refresh)").click();
}, interval);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment