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 :

DYNAMICS 365 HOW TO REFRESH SUBGRID IN JAVASCRIPT

Charles Abi Khirs Profile Picture Charles Abi Khirs 3,569

In other posts, we saw how to change the selected view of a subgrid and how to filter subgrid in JavaScript.

In this post, we will see how to refresh a subgrid in JavaScript in order to show the latest records related to a parent record upon an action on the form or clicking a ribbon button.

For the sake of this post, I will take the example of the cases subgrid related to an account record.

Refresh subgrid in JavaScript

Let's take the scenario, where an action is done on the client side that adds a case related to the account record. Therefore, the sub-grid should be automatically refreshed to reflect the updated list of cases.

In order to do this, a JavaScript function should call the refresh() in order to refresh the subgrid and display the expected result.

function refreshSubGrid(context) {
var formContext = context.getFormContext();
var subgrid = formContext.ui.controls.get("cases"); //Put the appropriate sub-grid name
subgrid.refresh();
}


Refresh subgrid in JavaScript 2

In case you are opening a web resource where you need to refresh the sub-grid, you can use the parent.Xrm.Page.ui.controls.get("cases").refresh(); or the form context as detailed in this post.


Hope This Helps!

This was originally posted here.

Comments

*This post is locked for comments