Dynamics 365 JavaScript Subgrid Refresh

Leave a comment

Here we will go through an example of refreshing a Dynamics 365 subgrid using JavaScript.

Let’s say we want the Recent Opportunities subgrid of an Account to refresh after a user presses a button. We have a web resource with a button that will run some JavaScript code:

Edit the form to look up the name of the subgrid:

Now add the code to the JavaScript behind the button:

parent.Xrm.Page.getControl("accountopportunitiesgrid").refresh();

Note in running this from within Dynamics 365, e.g. a field change, we can use:

Xrm.Page.getControl("accountopportunitiesgrid").refresh();

Now, in a new window, create a new opportunity:

Click the Submit button. The JavaScript will run and refresh the subgrid:

 

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, BI, Web, Cloud and Data Science.

carldesouza.comLinkedIn Twitter | YouTube

 

Leave a Reply

Your email address will not be published. Required fields are marked *