I am adding a subgrid to the form and using javascript to set fetchxml and layoutxml for it. The filter works but the layout doesn't. It always shows the layout of the default view I picked through the form editor. Here is part of my code. Please help:
var ConnectionSubgrid = document.getElementById("RelatedSeats");
if (ConnectionSubgrid == null) {
setTimeout(function () { FilterConnectionSubgrid(); }, 2000); //if the grid hasn’t loaded run this again
return;
}
var AdmissionSeatFetchXML = '<fetch mapping="logical" count="50" version="1.0"><entity name="ttc_admissionseat"><attribute name="ttc_admissionseatid" /><attribute name="ttc_admissionseatstatus" /><attribute name="ttc_admissionsectionid" /><attribute name="ttc_admissionstatusdate" /> <attribute name="ttc_applicationid" /><attribute name="ttc_candidateid" /><attribute name="ttc_contactid" /><attribute name="ttc_continuingenrollmentid" /><attribute name="ttc_datatelsectionid" /><attribute name="ttc_datatelstatus" /><attribute name="ttc_datatelstatusdate" /><attribute name="ttc_registrarseatstatus" /> <attribute name="ttc_registrarseatstatusdate" /><attribute name="ttc_name" /><filter><condition attribute="statecode" operator="eq" value="0" /><condition attribute="ttc_applicationid" operator="eq" value="' + applicationid + '" /></filter></entity></fetch>';
ConnectionSubgrid.control.SetParameter("fetchXml", AdmissionSeatFetchXML);
var AdmissionSeatLayoutXML = '<grid name="resultset" object="10136" jump="ttc_name" select="1" icon="1" preview="1"> <row name="result" id="ttc_admissionseatid"> <cell name="ttc_admissionsectionid" width="280"/><cell name="ttc_admissionseatstatus" width="120"/> </row></grid>';
ConnectionSubgrid.control.SetParameter("layoutXml", AdmissionSeatLayoutXML);
ConnectionSubgrid.control.Refresh();
Xrm.Page.ui.controls.get("RelatedSeats").refresh();
Thanks.
Holly
*This post is locked for comments