Refresh CRM Grid using JavaScript

In Microsoft Dynamics 365, there are many occasions that you need to refresh either form or view programmatically using JavaScript. I will list down how you can achieve this in supported way.  

Home Page Grid refresh 
It is little tricky to refresh view programmatically. One of the common scenario where you need to do this is if you have a custom button on home page grid and would like to refresh view to automatically reflect the changes. There is a supported way to achieve this.  

Using Ribbon Workbench pass CRM Parameter ‘SelectedControl’ to your command’s Custom JS action, and then in JS function just use below line after all the processing is completed.  

Syntax
selectedControl.refresh(); 

Form Refresh
As you are on form and you have access to form context, it is very easy to refresh form asynchronously without reloading the page as shown below

Syntax
formContext.data.refresh(save).then(successCallback, errorCallback); 

Parameter

Name  Type  Required  Description 
save  Boolean  No  true if the data should be saved after it is refreshed, otherwise false. 
successCallback  Function  No  A function to call when the operation succeeds. 
errorCallback  Function  No  A function to call when the operation fails. 

Hope this helps to achieve your goal in supported way. Please share your comments.  

Like this article?

Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Pinterest

Let Nemely  keep you updated!

Questions, comments, or suggestions? Contact us, and we’ll get back to you as soon as possible.

Related Posts

Webinar: Work More Efficiently with Copilot and AI in Microsoft Dynamics

Webinar: Work More Efficiently with Copilot and AI in Microsoft Dynamics

In the rapidly evolving world of technology, artificial intelligence (AI) continues to play a significant role in…
Connect to Multi-factor Enabled D365 Dataverse/CDS Programmatically Using Certificates (Online 9.1)

Connect to Multi-factor Enabled D365 Dataverse/CDS Programmatically Using Certificates (Online 9.1)

As the continuation to my earlier blog post, “Connect MFA Enabled D365 CDS Programamatically”, where we connected…
Generate PDF Report in Dynamics CRM 365

Generate PDF Report in Dynamics CRM 365

There is plenty of material available to achieve this very commonly needed functionality to generate PDF of…

Read More About Our Products

crm alerts hero
AppIcon_Colorful
CRM Alerts
The ultimate companion app for your mobile CRM users. CRM Alerts simplifies the work life for any CRM user that is doing sales-related activities with their mobile devices on a regular basis
shutterstock_710149132
Access Templates Icon 2
Access Templates
User security role and team assignment solution. Do you have a complex security model in your CRM system and having difficulty keeping track of which security roles and teams to assign to different user types? We have a solution for you!
NemelyProspectingHero
NemelyProspecting
Nemely Prospecting
Get relevant and up-to-date company information. With Nemely Prospecting, you can easily find and import company information directly from within your CRM.
Product Lifecycle Management
PLM Icon
Product Lifecycle
Asset and contract management. Manage customer assets and related contracts in Dynamics CRM. It's a plug-and-play solution, completely customizable, uses latest technology, works on all devices, and more.
shutterstock_1233205321
Sharepoint Extended
Sharepoint Extended
Enhanced document management. Built on top of the native integration between Microsoft Dynamics and Sharepoint, our solution Sharepoint Extended extends the functionality with better user experience, default structures, and document template creation.
Nemely Essentials
Nemely Essentials Inverted
Nemely Essentials
Dynamics CRM for small businesses. With the power of Dynamics 365 under the hood, but with a clean and simplified user experience with clever time-saving functionalities, you really get the best of both worlds.
Legal Practice Management
Legal Icon
Legal Practice Management
Client Relationship Management for law firms. Our packaged solution for law firms, built on top of Microsoft Dynamics 365 and Project Operations, combines several processes related to the acquiring, compliance validation, onboarding, delivery, and invoicing of legal services.