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

Notifications

Announcements

No record found.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans