locked
addCustomFilter issue RRS feed

  • Question

  • I'm trying to get a list of connections to an account to pre-populate a lookup, however it's just clocking right now whenever I click on it.

    In the Chrome console I get a 500 Internal Server Error.

    Can someone take a look at my call and xml to see if I have it set up right?

    function preFilterLookup() 
    {
       
        Xrm.Page.getControl("new_billto").addPreSearch(function(){
               addLookupFilter(); 
           } );    
    }

    function addLookupFilter() 
    {
       var potentialCustomer = Xrm.Page.getAttribute("customerid").getValue();
       var accountId = potentialCustomer[0].id;
       var name = potentialCustomer[0].name;
           
       if (potentialCustomer != null) {
            fetchXml = "<filter type='and'><condition attribute='record1id' operator='eq' uiname='" + name + "'uitype='account' value='" + accountId + "' /><condition attribute='record2roleid' operator='eq' uiname='Alternate Bill-To' uitype='connectionrole' value='0F962F93-DDB5-E311-8FAC-6C3BE5A8C238' </filter>";            
    Xrm.Page.getControl("new_billto").addCustomFilter(fetchXml, account);
       }

    }

    Monday, March 31, 2014 7:02 PM