Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Refresh an Editable Sub Grid with JavaScript

(0) ShareShare
ReportReport
Posted on by

I have tried the following:

  • document.all['GridName'].control.refresh();
  • document.getElementById("GridName").control.fireControlEvent("OnRefresh", Sys.EventArgs.Empty);
  • window.parent.opener.document.getElementById("GridName").control.refresh();
  • var subgrid = Xrm.Page.ui.controls.get("GridName");
    subgrid.refresh();

All to no avail and keep getting: TypeError: Cannot read property 'refresh' of null at refreshSubGrid  

Any help most welcome

EstimationLines

*This post is locked for comments

  • Emre GULCAN Profile Picture
    2,379 on at
    RE: Refresh an Editable Sub Grid with JavaScript

    Hi,

    Maybe you can use "data.refresh", it works with normal grids but don't test with editable grids.

    of course should not forget that this method refresh all form data

    msdn.microsoft.com/.../dn481607.aspx

  • Community Member Profile Picture
    on at
    RE: Refresh an Editable Sub Grid with JavaScript

    Thanks Goutam, adding in a Timeout fixed the issue.

  • Aric Levin - MVP Profile Picture
    30,188 Moderator on at
    RE: Refresh an Editable Sub Grid with JavaScript

    Hi,

    Can you validate the name of the grid is correct in your code, and that you are getting a return value for the following:

    var gridName = "new_subgridname";

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

    subgrid.refresh();

    Hope this helps.

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: Refresh an Editable Sub Grid with JavaScript

    Hi Graeme,

    Seems the control not loaded properly and it's getting null. So you can try to add setTimeout or set interval and offcourse null check of grid control before doing grid refresh.

    Hope this helps.

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: Refresh an Editable Sub Grid with JavaScript

    The error "Cannot read property 'refresh' of null at refreshSubGrid" sim,ply means that the the script is unable to find the subgrid.

    Ensure youi are using the correct name

    Hope this helps.

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: Refresh an Editable Sub Grid with JavaScript

    Hi Greame,

    Which version are you in? I tried it on 8.2 and it is working as expected.

    I tried on the out of box Account entity for the Contacts subgrid. Here is the sample script

    ========

    function refreshContactGrid()

    {

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

    subgrid.refresh();

    }

    =============

  • Community Member Profile Picture
    on at
    RE: Refresh an Editable Sub Grid with JavaScript

    I just keep getting the error: Cannot read property 'refresh' of null at refreshSubGrid

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans