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.
//Set Subgrid Data on change of lookup in CRM 2016 onpremise ver.
ReplyDeletefunction 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();
}
}