Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

How to force a sub-grid to refresh using javascript?

Posted on by

I have added a custom button to the command bar on the sub grid for records associated with the current record.  So I load up a particular record, use the sitemap tiles to view the sub-grid for some associated records, and click the new button on the command bar.  The button fires some javascript function that in turn triggers updates on the records listed in the sub-grid.  What I would like to do is force the sub-grid to refresh after the updates instead of clicking the refresh icon on the sub-grid manually.  Thanks for the help.

*This post is locked for comments

  • Suggested answer
    Kathan Profile Picture
    Kathan 20 on at
    RE: How to force a sub-grid to refresh using javascript?

    try calling this function on main form load or save event

    function refresh(executionContext) {

       var formContext = executionContext.getFormContext();

         formContext.ui.refresh();

    }

  • Srikanth Reddy Profile Picture
    Srikanth Reddy 135 on at
    RE: How to force a sub-grid to refresh using javascript?

    Thanks for your response and I have already tried with the below code in onload of the form but still i am facing the same issue for the first time of loading the page.

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

    subgrid .refresh();

  • AK350 Profile Picture
    AK350 on at
    RE: How to force a sub-grid to refresh using javascript?

    Wow, that's easy. I was looking through the SDK doc and searching online and didn't find that but I figured I had to be missing something.  Thank you!

  • Verified answer
    Royal King Profile Picture
    Royal King 27,686 on at
    RE: How to force a sub-grid to refresh using javascript?

    below script will refresh the subgrid

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

    subgrid .refresh();

    Below post gives detailed information how to refresh the subgrid from ribbon button

    http://a33ik.blogspot.com/2012/11/how-to-refresh-associated-or-subgrid.html

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,151 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,993 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans