locked
crm lookup additionalparam search value with & gives error RRS feed

  • Question

  • I have lookup in my order product form. for a custom entity. I need to limit the lookup by passing search values from order product name and customer id for the order.

    this lookup works unless there is no & in the order product name. I have generate search string on form onload and I tried to replace & using  pdesc = pdesc.replace(/\&/g,'%26'); but this is not working . gives error page I did same for + sign pdesc = pdesc.replace(/\+/g,'%2B'); now lookup works if product name got + sign. how do i avoid & in order product so the lookup works?

    my  javascript , any help appriciated...

    var pdesc = crmForm.all.productid.DataValue[0].name.toString();
    
    pdesc = pdesc.replace(/\+/g,'%2B');
    pdesc = pdesc.replace(/\&/g,'%26');
    
    if (cus==''){
    crmForm.all.new_servicechargeid.additionalparams = 'search=' +pdesc;
    }
    else
    {
    cus= cus.replace('{','');
    cus=cus.replace('}','');
     var filterCondition = "<filter type='and'>" + 
     "<condition attribute='qg_description' operator='eq' value='"+pdesc+"'/>" + 
    "<condition attribute='qg_accountid' operator='eq' value='"+cus+"'/>" +
     "</filter>"; 
    
     var fetchXML; 
    //crmForm.all.new_servicechargeid.lookupbrowse = 1; 
    fetchXML = "<fetch mapping='logical'>" + 
    "<entity name='qg_servicecharge'>" + filterCondition + "</entity></fetch>"; 
    crmForm.all.new_servicechargeid.additionalparams = "search=" + fetchXML;
    
    }
    
    
    

     

     

    Tuesday, August 16, 2011 2:02 PM

All replies