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

Filtering records in the sub grid in Microsoft Dynamics CRM 2011

$
0
0

Hi, please tell me how can I liquidate"error on the page" error? It occurs when I try to open a record from the sub grid or click on the sub grid window to add a new record. Here is my code:

 

// JavaScript source code

 

function FilterSubgrid() {

 

 

    var ContractType = Xrm.Page.data.entity.attributes.get("new_contacts");

 

    ContractTypeDisplayValue = ContractType.getValue();

 

    if (ContractTypeDisplayValue != null && (ContractTypeDisplayValue == 100000000 || ContractTypeDisplayValue == 100000001)) {

 

        var filterId = Xrm.Page.data.entity.getId(); // yntacik glxavor kam varkajin pajmanagir

 

        var yoursubgridnameObject = document.getElementById("apahovman_pajmanagir"); // yoursubgridname

 

        if (yoursubgridnameObject == null || yoursubgridnameObject.readyState != "complete") {

 

            setTimeout('FilterSubgrid()', 1000);

 

            return;

        }

        if (filterId == null) return;

        var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>";

        fetchXml += "<entity name='new_loan_agreement'>";

        fetchXml += "<attribute name='new_name'/>";

        fetchXml += "<attribute name='new_contacts'/>";

        fetchXml += "<attribute name='new_deadline'/>";

        fetchXml += "<attribute name='new_text'/>";

        fetchXml += "<attribute name='new_loan_agreementid'/>";

        fetchXml += "<order attribute='new_deadline' descending='false' />";

        fetchXml += "<link-entity name='new_contract_intersection' from='new_lookup_apahovutjun' to='new_loan_agreementid' alias='aa'>";

        fetchXml += "<filter type='and'>";

        fetchXml += "<condition attribute='new_lookup_glxavor_varkajin' operator='eq' uitype='new_loan_agreement' value='" + filterId + "' />";

 

        fetchXml += "</filter>";

        fetchXml += "</link-entity>";

        fetchXml += "</entity>";

        fetchXml += "</fetch>";

        yoursubgridnameObject.control.setParameter("fetchXml", fetchXml);

        yoursubgridnameObject.control.refresh();

    }

}

 

Thanks!


Viewing all articles
Browse latest Browse all 82002

Trending Articles