Hi all,
I have my code as advised by this article:
http://stackoverflow.com/questions/32564310/dynamics-crm-2015-online-subgrids-control-setparameter-method-is-not-available
I use window.parent.document.getElementById to get the subgrid reference and it ALWAYS returns NULL even after the setting timeout.
I then tried Xrm.Page.getControl("subgridname").getGrid() to get the subgrid reference which works but then when I use control.SetParameter
it returns "unable to get property 'SetParameter' of undefined or null reference"
I do realise this is unsupported but it seems like this is the only way to do it, has anyone got this to work?
My code is:
function GetSubgrid() { var relatedOpportunitiesGrid = window.parent.document.getElementById("Pursuit_Team"); if (relatedOpportunitiesGrid == null) { setTimeout('GetSubGrid()', 500); return; } var fetchXml = "<fetch>Fetxml goes here</fetch>"; if (relatedOpportunitiesGrid.control != null) { relatedOpportunitiesGrid.control.SetParameter("fetchXml", fetchXml); //set the fetch xml to the sub grid relatedOpportunitiesGrid.control.refresh(); //refresh the sub grid using the new fetch xml } else { setTimeout('GetSubGrid()', 500); } }