CRM 2011 Refresh Form after Subgrid Changes or Refresh

I 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:

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:

Hope this helps,


Hi Andreas,

Sounds like this could be exactly what I am looking for. Can you tell me where to put the SubGridRefresh and ReLoadForm? I am using a subgrid for a custom entity Market Profile on the Account Form. I am not really technical so maybe you can explain in little bit more detail for me!

Many thanks in advance,
Aad van der Velden


Hi Aad,

Just put those code into a JS file, upload it as a webresource, then put it on a form. In the form load event just call the Form_onload method and you're ready to go.




thanks for your tutorial. I have one Problem: I would like to attach the "OnRecordInserted" "OnRecordUpdated", "OnRecordDeleted" event on the subgrid.

The main problem is, that if I attach my function to the "onrefresh" event, sometimes the event already gets triggered when my main form is loaded for the first time, so when I insert a new record into my subgrid a page reload will occur and it ends up in an endless loop.

When I analyze the subgrid object within the IE9 Debugger, I can see a lot of other events, but I can't attach my function to it:

Would like to hear what you think about that attaching other events then onrefresh.



I don't think the other events (of html table) are accessible in CRM. The onrefresh is a special event for subgrid. You can try the addEventListener function instead of attachEvent though.

Another way you can try is to just perform partial refresh of the main form instead of the full refresh (I wrote it in other article on how to achieve this)



Post a Comment