Refresh SubGrid from JavaScript in CRM 2011, 2013 and 2015

We can refresh the subgrid on the form using JavaScript. Can use the same code on ribbon button click or onchange or wherever depending on the requirement.
 
Xrm.Page.ui.controls.get(“SubGridName”).refresh();

Here is the way to get the name of the subgrid.


Happy CRM’img
Gopinath.

One thought on “Refresh SubGrid from JavaScript in CRM 2011, 2013 and 2015

  1. Shital October 30, 2016 / 12:36 pm

    //Set Subgrid Data on change of lookup in CRM 2016 onpremise ver.function setCustomers() { var id = Xrm.Page.getAttribute(\”vrp_customerid\”);//Selected Lookup var name = null; if(id!=null && id.getValue()!=null) { id = Xrm.Page.getAttribute('vrp_customerid').getValue()[0].id; name = Xrm.Page.getAttribute('vrp_customerid').getValue()[0].name; var subgrid = window.parent.document.getElementById(\”Customers\”); // Select Subgrid if (subgrid == null) { setTimeout('setCustomers()', 2000); return; } var fetchXml = \”\”+ \”\”+ \”\”+ \”\”+ \”\”+ \”\”+ \”\”+ \”\” + \”\” + \”\” + \”\”; subgrid.control.SetParameter(\”fetchXml\”, fetchXml); subgrid.control.refresh(); }}

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s