locked
Fetch xml through subgrid binding RRS feed

  • Question

  • Hi

    I have written the Fecth xml for binding the subgrid

    1.Product entity have field abc_minentryage

    2.Contact entity have filed like abc_agelastbirthday'

    i have to compare the product entity age with contact enity age nd fill into the subgrid of contact entiy page

    pls check below code it's not working can you  pls suggest it

    function updateSubGrid()
    {
        var relatedProducts = document.getElementById("crosssellproducts");
        var contactage = Xrm.Page.data.entity.attributes.get('abc_agelastbirthday').getValue();
           if (relatedProducts == null || relatedProducts.readyState != "complete")
               {
                  setTimeout('updateSubGrid()', 1000);
                  return;
               }

        //This is the fetch xml code which will retrieve all the order products related to the order selected for the case.

        var fetchXml;
        fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>";
        fetchXml += "<entity name='Product'>";
        fetchXml += "<attribute name='name' />"; 
        fetchXml += "<attribute name='Productnumber' />";
        fetchXml += "<attribute name='abc_investmenttypes' />";
        fetchXml += "<attribute name='abc_plantype' />";
       fetchXml += "<filter type='and'>";
        fetchXml += "<condition attribute='abc_minentryage' operator='eq'  value= '" + contactage + "' />";
        fetchXml += "</filter>";
         fetchXml += "</entity>";
        fetchXml += "</fetch>";

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

        //relatedProducts.control.refresh();

    }


    Rammohan

    Thursday, June 20, 2013 9:05 AM