Hi, I'm working on Dynamics CRM 2016 (8.1) on premise, and I'm trying to filter a subgrid on onload form event via fetch xml, but I get this error
My function is:
function filterSubGridsRegBonus() { filterSubGrid("Subgrid_1"); filterSubGrid("Subgrid_2"); } function filterSubGrid(subgridName) { var formContext = Xrm.Page; var entityId = formContext.data.entity.getId().replace('{', '').replace('}', ''); var entityName = formContext.getControl("EntityName").getEntityName(); var subgrid = window.parent.document.getElementById(subgridName); if (subgrid == null) { setTimeout(function () { filterSubGrid(); }, 2000); return; } var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" + "<entity name='" + entityName + "' >" + "<all-attributes/>" + "<filter type='and' >" + "<condition attribute='param1' operator='neq' value='" + entityId + "' />" + "</filter>" + "<filter type='and' >" + "<condition attribute='param2' operator='neq' value='" + entityId + "' />" + "</filter>" + "</entity>" + "</fetch>"; subgrid.control.SetParameter("fetchXml", fetchXml); subgrid.control.refresh(); }
How can I solve this? Thank you!
*This post is locked for comments