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)

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

(0) ShareShare
ReportReport
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

  • Verified answer
    Royal King Profile Picture
    27,686 on at

    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

  • AK350 Profile Picture
    on at

    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!

  • Srikanth Reddy Profile Picture
    135 on at

    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();

  • Suggested answer
    Kathan Profile Picture
    20 on at

    try calling this function on main form load or save event

    function refresh(executionContext) {

       var formContext = executionContext.getFormContext();

         formContext.ui.refresh();

    }

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
TNJ_CRM_Team Profile Picture

TNJ_CRM_Team 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans