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 :
Service | Customer Service, Contact Center, Fie...
Suggested Answer

D365 Model Driven UI - Javascript how to refresh associated grid

(1) ShareShare
ReportReport
Posted on by 18

How do you refresh the grid of a related entity in javascript?

pastedimage1587649721343v1.png

Say you are in the Main Entity form and you click on the Related entity called Product Category --> The Product Category associated View appears and when I click on the custom button Manage Product Category I want the grid to be refreshed:

OnCopyClick: function (primaryControl,outletId) {
debugger;
var formContext = primaryControl;
var grid = formContext.getControl("whatShouldISearchHere?");
grid.refresh();

}

how do I get the control of a Related entity?

I have the same question (0)
  • Suggested answer
    ___Pool___ Profile Picture
    18 on at

    On Ribbon workbench in order to the get the grid control I added another crm parameter to the function : "Selected Control"

    OnCopyClick: function (primaryControl,outletId,selectedcontrol) {

                   debugger;

                   var formContext = primaryControl;

                   var grid = formContext.getControl("Product");

                   if(selectedcontrol != null){

                       grid = selectedcontrol;

                   }

                   grid.refresh();

    }

    now it works like a charm

  • Suggested answer
    Johao Larios Profile Picture
    1,795 on at

    Awesome,

    This is our recommended way to get the gridContext:

    var formContext = executionContext.getFormContext(); // get the form Context

      var gridContext = formContext.getControl("Contacts"); // get the grid context

    More info about how to interact with grids: docs.microsoft.com/.../clientapi-grid-context

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
FSRon Profile Picture

FSRon 75

#2
James White Profile Picture

James White 21

#3
AT-28040446-0 Profile Picture

AT-28040446-0 20

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans