Answered by:
CRM 2011 Cases Auto Refresh

Question
-
I've just upgraded from CRM 4 to CRM 2011, the upgrade went perfect except the auto refresh code that we had in the home_cases.aspx file doesn't seem to work anylonger. Here is the code that I was using:
function window.onload()
{
HandleBackButtonIssues("cases");
window.setInterval("crmGrid.Refresh();", 30000); //this will refresh the cases grid every 30 seconds
}What do I need to do to have auto refresh work again?
Tuesday, August 30, 2011 8:31 PM
Answers
-
Hi,
Instead of adding a new line of code for body tag, you need to edit the exsisting body tag line, your code should be:
<%@ Page language="c#" Inherits="Microsoft.Crm.Web.EntityHomepage" CodeBehind="Microsoft.Crm.Application.Pages.dll" %>
< %@ Register TagPrefix="mnu" Namespace="Microsoft.Crm.Application.Menus" Assembly="Microsoft.Crm.Application.Components.Application" %>
< %@ Register TagPrefix="cnt" Namespace="Microsoft.Crm.Application.Controls" Assembly="Microsoft.Crm.Application.Components.Application" %>
< %@ Register TagPrefix="ui" Namespace="Microsoft.Crm.Application.Components.UI" Assembly="Microsoft.Crm.Application.Components.UI" %>
< %@ Register TagPrefix="loc" Namespace="Microsoft.Crm.Application.Controls.Localization" Assembly="Microsoft.Crm.Application.Components.Application" %>
< %@ Import Namespace="Microsoft.Crm.Application.Pages.Common" %>
< html>
< head>
< cnt:AppHeader runat="server" id="crmHeader"/><script langugae="javascript">
function BodyOnload()
{
// 112 is etc code for case entity
if ( getQueryString("etc") == 112)
{
window.setInterval('crmGrid.Refresh();', 3000);
}
}
function getQueryString(key)
{
var default_;
if (default_==null) default_="";
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
var qs = regex.exec(window.location.href);
if(qs == null)
return default_;
else
return qs[1];
}
</script>
< /head><body class="stage" onload="BodyOnload();">
< ui:EventManager runat="server" id="crmEventManager"></ui:EventManager>
<table class="stdTable" cellpadding="0" cellspacing="0">
< tr>
< td style="height:0%"><cnt:InAppContent id="crmInAppContent" runat="server"/></td>
< /tr>
< tr height="29" runat="server">
< td runat="server"><table class="homepage_table" width="100%" cellpadding="0" cellspacing="0" runat="server">
< tr runat="server">
< td runat="server" style="padding: 0px;"><cnt:GridControlBar runat="server" id="gridControlBar"/></td>
< /tr>
< /table></td>
< /tr>
< tr height="25" runat="server">
< td class="homepage_menubar" runat="server"><mnu:AppGridMenuBar id="crmMenuBar" runat="server"/></td>
< /tr>
< tr>
< td id="homepageTableCell" runat="server">
< /td>
< /tr>
< /table></body>
< /html>
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".- Proposed as answer by Jehanzeb.Javeed Tuesday, September 6, 2011 8:38 PM
- Marked as answer by Mark-A Tuesday, September 6, 2011 8:45 PM
Tuesday, September 6, 2011 8:38 PM
All replies
-
Hi,
In CRM 2011 try the following solution:
1. Go to <CRM Web>\_root directory and open file HomPage.aspx in notpad and add the following code in the head tag of the page i.e:
<head>
<cnt:AppHeader runat="server" id="crmHeader"/><script langugae="javascript">
function BodyOnload()
{
// 112 is etc code for case entity
if ( getQueryString("etc") == 112)
{
window.setInterval('crmGrid.Refresh();', 3000);
}
}function getQueryString(key)
{
var default_;
if (default_==null) default_="";
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
var qs = regex.exec(window.location.href);
if(qs == null)
return default_;
else
return qs[1];
}</script>
</head>
2. Add the function call code below in the body tag i.e.
<body class="stage" onload="BodyOnload();">
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".- Proposed as answer by Jehanzeb.Javeed Tuesday, August 30, 2011 11:50 PM
Tuesday, August 30, 2011 11:49 PM -
Maybe I'm placing the code wrong, but just to verify where do I put <body class="stage" onload="BodyOnload();">. As a experiment I put it in the CS\Home_cases.aspx just verify it was working and neither place in the "BODY" seem to work. Can I ask for some more assistance please?Tuesday, September 6, 2011 8:26 PM
-
Hi,
In CRM installation directory go to _root folder open file HomPage.aspx and then add the code in this file.
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".Tuesday, September 6, 2011 8:30 PM -
I have added the code there also. Here is my file: I bolded the code below.
<%@ Page language="c#" Inherits="Microsoft.Crm.Web.EntityHomepage" CodeBehind="Microsoft.Crm.Application.Pages.dll" %>
<%@ Register TagPrefix="mnu" Namespace="Microsoft.Crm.Application.Menus" Assembly="Microsoft.Crm.Application.Components.Application" %>
<%@ Register TagPrefix="cnt" Namespace="Microsoft.Crm.Application.Controls" Assembly="Microsoft.Crm.Application.Components.Application" %>
<%@ Register TagPrefix="ui" Namespace="Microsoft.Crm.Application.Components.UI" Assembly="Microsoft.Crm.Application.Components.UI" %>
<%@ Register TagPrefix="loc" Namespace="Microsoft.Crm.Application.Controls.Localization" Assembly="Microsoft.Crm.Application.Components.Application" %>
<%@ Import Namespace="Microsoft.Crm.Application.Pages.Common" %>
<html>
<head>
<cnt:AppHeader runat="server" id="crmHeader"/><script langugae="javascript">
function BodyOnload()
{
// 112 is etc code for case entity
if ( getQueryString("etc") == 112)
{
window.setInterval('crmGrid.Refresh();', 3000);
}
}
function getQueryString(key)
{
var default_;
if (default_==null) default_="";
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
var qs = regex.exec(window.location.href);
if(qs == null)
return default_;
else
return qs[1];
}
</script>
</head><body class="stage">
<ui:EventManager runat="server" id="crmEventManager"></ui:EventManager><table class="stdTable" cellpadding="0" cellspacing="0">
<tr>
<td style="height:0%"><cnt:InAppContent id="crmInAppContent" runat="server"/></td>
</tr>
<tr height="29" runat="server">
<td runat="server"><table class="homepage_table" width="100%" cellpadding="0" cellspacing="0" runat="server">
<tr runat="server">
<td runat="server" style="padding: 0px;"><cnt:GridControlBar runat="server" id="gridControlBar"/></td>
</tr>
</table></td>
</tr>
<tr height="25" runat="server">
<td class="homepage_menubar" runat="server"><mnu:AppGridMenuBar id="crmMenuBar" runat="server"/></td>
</tr>
<tr>
<td id="homepageTableCell" runat="server">
</td>
</tr>
</table><body class="stage" onload="BodyOnload();">
</body>
</html>Tuesday, September 6, 2011 8:33 PM -
Hi,
Instead of adding a new line of code for body tag, you need to edit the exsisting body tag line, your code should be:
<%@ Page language="c#" Inherits="Microsoft.Crm.Web.EntityHomepage" CodeBehind="Microsoft.Crm.Application.Pages.dll" %>
< %@ Register TagPrefix="mnu" Namespace="Microsoft.Crm.Application.Menus" Assembly="Microsoft.Crm.Application.Components.Application" %>
< %@ Register TagPrefix="cnt" Namespace="Microsoft.Crm.Application.Controls" Assembly="Microsoft.Crm.Application.Components.Application" %>
< %@ Register TagPrefix="ui" Namespace="Microsoft.Crm.Application.Components.UI" Assembly="Microsoft.Crm.Application.Components.UI" %>
< %@ Register TagPrefix="loc" Namespace="Microsoft.Crm.Application.Controls.Localization" Assembly="Microsoft.Crm.Application.Components.Application" %>
< %@ Import Namespace="Microsoft.Crm.Application.Pages.Common" %>
< html>
< head>
< cnt:AppHeader runat="server" id="crmHeader"/><script langugae="javascript">
function BodyOnload()
{
// 112 is etc code for case entity
if ( getQueryString("etc") == 112)
{
window.setInterval('crmGrid.Refresh();', 3000);
}
}
function getQueryString(key)
{
var default_;
if (default_==null) default_="";
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
var qs = regex.exec(window.location.href);
if(qs == null)
return default_;
else
return qs[1];
}
</script>
< /head><body class="stage" onload="BodyOnload();">
< ui:EventManager runat="server" id="crmEventManager"></ui:EventManager>
<table class="stdTable" cellpadding="0" cellspacing="0">
< tr>
< td style="height:0%"><cnt:InAppContent id="crmInAppContent" runat="server"/></td>
< /tr>
< tr height="29" runat="server">
< td runat="server"><table class="homepage_table" width="100%" cellpadding="0" cellspacing="0" runat="server">
< tr runat="server">
< td runat="server" style="padding: 0px;"><cnt:GridControlBar runat="server" id="gridControlBar"/></td>
< /tr>
< /table></td>
< /tr>
< tr height="25" runat="server">
< td class="homepage_menubar" runat="server"><mnu:AppGridMenuBar id="crmMenuBar" runat="server"/></td>
< /tr>
< tr>
< td id="homepageTableCell" runat="server">
< /td>
< /tr>
< /table></body>
< /html>
Jehanzeb Javeed
http://worldofdynamics.blogspot.com
Linked-In Profile |CodePlex Profile
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".- Proposed as answer by Jehanzeb.Javeed Tuesday, September 6, 2011 8:38 PM
- Marked as answer by Mark-A Tuesday, September 6, 2011 8:45 PM
Tuesday, September 6, 2011 8:38 PM -
Thank sir that worked!!!!Tuesday, September 6, 2011 8:45 PM
-
This is a great post!!!!!!!!!
If I want to have auto refresh on other entity, is it just change the etc code??
How to find the etc code of other entity?
Friday, September 16, 2011 4:48 AM -
I got it...
var etc = Xrm.Page.context.getQueryStringParameters().etc
Friday, September 16, 2011 5:00 AM -
Hi ,
I also have a similar requirement to write FETCHXML query on the OOTB view of a custom entity .
Can you please help me to answer the following queries in this regard :
1. Is it possible to write fetch XML in the OOTB view
2. In which file should we write the code to refresh OOTB view for every 3 sec
3. Is this MS supported way ?
thanks
Krithi
Tuesday, September 30, 2014 4:14 AM