Hi,
Anyone knows if there's a problem with the subgrid implementation in crm 2016? This is the code I'm using but I never get any records from the grid even though a reference to the grid is returned.
SetProductGridOnLoad: function () { var productGridControl = Xrm.Page.getControl("subgrid_products"); productGridControl.addOnLoad(FBCrm.Lead.SetProductGridTimer); }, SetProductGridTimer: function() { setTimeout(FBCrm.Lead.CalculateLeadProductsTotal, 2000); }, /* * Re-Calculates the total when a new product is added to the * Lead products grid */ CalculateLeadProductsTotal: function () { var productGrid = Xrm.Page.getControl("subgrid_products").getGrid(); var productRows = productGrid.getRows(); // this always returns 0 var total = 0; productRows.forEach(function (attribute, index) { var rowEntity = attribute.getData().getEntity(); var listPrice = rowEntity.getAttributes().get("price"); total += listPrice; }); Xrm.Page.getAttribute("cust_totalprice").setValue(total); Xrm.Page.getAttribute("cust_totalprice").setSubmitMode("always"); },
Thanks
Tony
Tony