web
You’re offline. This is a read only version of the page.
close
Skip to main content
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 2

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
    2 on at
    RE: D365 Model Driven UI - Javascript how to refresh associated grid

    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
    RE: D365 Model Driven UI - Javascript how to refresh associated grid

    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 46 Super User 2025 Season 2

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 40

#3
CU23101130-0 Profile Picture

CU23101130-0 17

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans