Auto Refresh SSRS Reports in SharePoint 2010 Part II

So it turns out that refreshing all reports on a dashboard may not provide you with the desired user experience; Content Editor to the rescue.

Add a Content Editor Control web part to your Web Page

First find the ID of the Refresh Button on on the SSRS webpart tool bar of the report to be refreshed; I used IE Developer tools to find the ID.

Once you have the ID,  add the following script to the content Editor control and every 60 seconds the report gets refreshed.

<script type=”text/javascript”>

function refreshReport()
{
var btn = document.getElementById(“ID Goes Here“);
btn.click();
}

setInterval(‘refreshReport()’ ,60000);

</script>

Advertisements

Auto Refresh SSRS Reports in SharePoint 2010

Thank you Brian Keay for your post

http://briankeaybi.wordpress.com/2011/02/21/auto-refresh-ssrs-in-sharepoint-2010/

If you happened to find this post and were pulling your hair head like I was when you copied and pasted Brian’s code snippet and it did not work, try deleting the single and double quotations and retyping them in, stupid fonts. If you did not find Brian’s post I have included his code snippet below

<script type=”text/javascript”>
// The time out value is set to be 60,000 milli-seconds (or 60 seconds)
setTimeout(‘document.location=document.location’ ,60000);
</script>

Couple additional things to note.

1. you can save this script into a text file, store in a document library and point your content editor -> content link to the txt file

2. you can also type the script directly into the Content Editor HTML Editor, click in the content editor in edit page mode. You will see the Content Editor Ribbons. On the Format Text Ribbon there is a Markup section where you will find an option to edit HTML, type the script there.

Wait 60 seconds and voila, refresh

A giant thanks again to Brian