How to refresh Homepage Grid on click of custom ribbon button in Dynamics 365? Use Xrm.Utility.refreshParentGrid() API

This one I found pretty interesting. And in the community you will find this requirement popping up every now and then, specially the requirement to refresh HomePage grid and ribbon on click of a ribbon button. Let’s see the requirement that we had for this.

In this blog I am going to discuss the following requirements

  • How to refresh the HomePageGrid in dynamics 365/ CDS on click of custom ribbon button?
  • How to refresh an entity chart on a Dashboard in Dynamics 365/ CDS?
  • How to refresh an entity list on a Dashboard in Dynamics 365/ CDS?

Say your customer have a ribbon button on the Homepage grid of the Contact entity. The button appears when an item or more than one item is selected from the grid. And you perform some operations on the selected record and then refresh the Homepage grid to reflect the changes. Below is my custom button which on Contact Home Page grid.

image

In the ribbon button click function, once all the operations are completed, to refresh the grid you would need to fire the below lines of code to refresh the parent Homepage grid and ribbon.

var lookupOptions = {};
lookupOptions.entityType = “contact”;
Xrm.Utility.refreshParentGrid(lookupOptions);

And voila! You shall see your parent Homepage grid being refreshed with the below functions. Some hidden gems from Microsoft to do this small small cool stuffs.

Wait the the fun is not over yet. I am in the Sales Hub APP and I open the Sales Activity Dashboard.

image

And for this I launch my developer tools and try the below code.

var lookupOptions = {};
lookupOptions.entityType = “opportunity”;
Xrm.Utility.refreshParentGrid(lookupOptions);

And below is the experience.

Hope this helps!

(Dynamics MVP)

For consultation/ corporate training visit www.xrmforyou.com or reach out to us at info@xrmforyou.com

Our product offerings:

CRM-Sharepoint Attachment uploader and metadata manager (http://www.xrmforyou.com/sharepoint-integrator.html)

Notes Manager (https://debajmecrm.com/add-metadata-to-your-notes-and-attachments-in-dynamics-notes-metadata-manager-from-xrmforyou-com/)

Role based views for Dynamics 365 (http://www.xrmforyou.com/role-based-views.html)

Record Cloner for Dynamics 365 (http://www.xrmforyou.com/record-cloner.html)

1 thought on “How to refresh Homepage Grid on click of custom ribbon button in Dynamics 365? Use Xrm.Utility.refreshParentGrid() API”

Comments are closed.