I found this javascript code a while ago and was working great until some of the browsers have been updated to newer versions. Now the Home screen "locks up" after some users login. I've seen this issue on Macs, IE9, and sometimes Firefox. Any suggestions on how to keep the script from locking the page? Thanks in advance!!!

I found the code here:


<script type="text/javascript">
var run;
function refresh()
var dashboardButton = document.getElementById('db_ref_btn');
window.onload = setInterval(refresh);

This doesn't require any coding at all. You should be able to schedule a dashboard refresh within Salesforce.

The above is definitely the proper way to do this. I would not really suggest using the script below to do this as the DOM could change and all of this could stop working. Technically it is getting around the need to pay for higher tiered licensing which comes with the scheduled dashboard refresh as well.

With all of that said, the following Javascript should work:

<script type="text/javascript">      
    window.onload = function() { 
        var dashboardButton = document.getElementById('db_ref_btn');

The Javascript you included doesn't really make much sense. You have a run var you never use, and then you use setInterval() without specifying an interval to refresh on. This code will basically just click the Refresh button once the page loads.

  • Agreed, but there is a limit to how many dashboards I can auto refresh which is why I resorted to the script. Feb 15 '13 at 18:10
  • 1
    I believe I also added the script because the users were getting confused as to why the dashboards weren't automatically refreshing. Feb 15 '13 at 18:17
  • Just curious...is there some reason that Salesforce doesn't let you refresh this often...is this potentially somehow not allowed... Feb 15 '13 at 18:34
  • @PeterKnolle - Normally you have to use one of your scheduled job slots for dashboard refreshes, same as running a report. And you don't get many slots.
    – Mike Chale
    Feb 15 '13 at 18:35
  • Salesforce does limit this type of thing for performance issues as well as charging more for the ability to even do this. I don't really know if this type of thing is a violation, as mentioned in my post. Feb 15 '13 at 18:40

If you're on or Enterprise and Ultimate editions the schedule auto-refresh feature will works.

For other editions, you'll need the javascript to make it work. They limit this to keep you from doing something crazy like "run a report of all activity history for the past X months... auto-refresh every 5 minutes"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.