Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Subgrid filter not applied

$
0
0

Hello,

we are trying to apply a custom view/filter to one of our subgrids. Unfortunately the filter is not beeing applied. The Code runs without errors. Any ideas?

function Subgrid_setFilteredView()
{
	var viewId, entityName, customerId, qryContacts, layoutXml, viewDisplayName;

	// Check subgrid available
	var subgrid = window.parent.document.getElementById("FixedReceipientsVisitReport");
	if(subgrid==null || subgrid.control == null){ 
        setTimeout(function () { Subgrid_setFilteredView(); }, 1500); //if the grid hasn’t loaded run this again when it has 
        return;
    }	

    customerId = Xrm.Page.data.entity.getId();

    if (customerId !== undefined && customerId !== null) {
        viewId = "{a76b2c46-c28e-4e5e-9ddf-951b71202c9d}";	
        entityName = "contact";
        viewDisplayName = "Zugeordnete Kontakte / assigned contacts";

        qryContacts = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +
                          "  <entity name='contact'>" +
                          "    <attribute name='fullname' />" +
                          "    <attribute name='emailaddress1' />" +
                          "    <attribute name='parentcustomerid' />" +
                          "    <attribute name='telephone1' />" +
                          "    <filter type='and'>" +
                          "      <condition attribute='parentcustomerid' operator='eq' value='" + customerId + "' />" +
                          "      <condition attribute='statecode' operator='eq' value='0' />" +
                          "      <condition attribute='statuscode' operator='eq' value='1' />" +
                          "    </filter>" +
                          "  </entity>" +
                          "</fetch>";

        layoutXml = "<grid name='resultset' object='1' jump='name' select='1' icon='1' preview='1'>" +
                        "  <row name='result' id='contactid'>" +
                        "    <cell name='fullname' width='100' />" +
                        "    <cell name='emailaddress1' width='200' />" +
                        "    <cell name='parentcustomerid' width='200' />" +
                        "    <cell name='telephone1' width='100' />" +
                        "  </row>" +
                        "</grid>";

		subgrid.control.SetParameter("fetchXml", qryContacts); //set the fetch xml to the sub grid  
		subgrid.control.SetParameter("layoutXml", layoutXml); //set the layout xml to the sub grid  
		subgrid.control.Refresh();
		Xrm.Page.ui.controls.get("FixedReceipientsVisitReport").refresh();
	}
}

Thanks!


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>