web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

CRM Home Grid Refresh Using Java Script

(0) ShareShare
ReportReport
Posted on by 2

Hi All,

I have a requirement for refreshing the CRM home grid based on a button click.

I have added custom button and java script on the home grid of my entity, when a user clicks on the button the script will do some business logic and after that I need to refresh the home grid. 

I already tried the following code for achieving the same but it is not working. It is showing an error 'Unable to get property 'document' of undefined or null reference'

"window.parent.opener.document.getElementById("crmGrid").control.refresh();"

Can anyone help me ...

Thanks 

Abhiram

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Hemant Kumar Sahu Profile Picture
    1,829 on at

    Hi Abhiram,

    Use timeout conecpts. You are trying access that grid not yet ready.

    function Form_OnLoad() {

     setTimeout(subGridA_OnLoad, 1000); //We're using setTimeout() here because subgrids are loaded after $(document) is ready.

    }

    function subGridA_OnLoad() {

     var subgridA = document.getElementById("subgridA");

     subgridA.attachEvent("onrefresh", RefreshSubgridB);

    }

    function RefreshSubgridB() {

     var subgridB = Xrm.Page.ui.controls.get("subgridB");

     subgridB.refresh();

    }

    Hope this will help you . :)

    Thanks

    Hemant Kumar

  • Nha Profile Picture
    65 on at

    Hi, you can try to get the IFRAME id of the home grid and do a refresh.

    try{

                       parent.document.getElementById('contentIFrame0').contentWindow.document.getElementById('crmGrid').control.refresh();

                   } catch (e0) { }

                   try{

                       parent.document.getElementById('contentIFrame1').contentWindow.document.getElementById('crmGrid').control.refresh();

                   } catch (e1) { }

                   try {

                       parent.document.getElementById('contentIFrame2').contentWindow.document.getElementById('crmGrid').control.refresh();

                   } catch (e2) { }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Varsha deshpande Profile Picture

Varsha deshpande 5

#2
JS-09031509-0 Profile Picture

JS-09031509-0 3

#3
Ciprian  P Profile Picture

Ciprian P 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans