CRM 2011 Refresh Form after Subgrid Changes or Refresh

CRM 2011 Refresh Form after Subgrid Changes or Refresh

found on some articles that to be able to do this you need to attach an OnRefresh event to the element that then calls the function to load the parent window again:

var grid = document.getElementById(“MySubGrid”);

grid.attachEvent(“onrefresh”, ReLoadForm);
When I deployed to CRM 2011 Rollup 3, I found some issues that throw error like null object (document not ready) and in some IE versions the form keeps refreshing for eternity…

After spending some time investigating this annoying issue, I found out that we have to wait for the subgrid to finish loading its contents for this to work properly. The final javascript is as follows:

function Form_onload() {

setTimeout(“SubGridRefresh();”, 2500);

}

function SubGridRefresh() {

var grid = document.getElementById(“MySubGrid”);

if (grid) {

grid.attachEvent(“onrefresh”, ReLoadForm);

}

}

function ReLoadForm() {

window.location.reload(true);

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s