I have a javascript web resource overriding the fetchXml based on the company name in the lead entity. When the companyname contains an '&', I receive an error. Does anyone know anything I can do to make this work without throwing an error? The fetchXml is below.
var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>";
fetchXml += "<entity name='lead'>";
fetchXml += "<attribute name='ownerid' />";
fetchXml += "<attribute name='statecode' />";
fetchXml += "<attribute name='companyname' />";
fetchXml += "<attribute name='fullname' />";
fetchXml += "<attribute name='leadid' />";
fetchXml += "<order attribute='fullname' descending='false' />";
fetchXml += "<filter type='and'>";
fetchXml += "<condition attribute='companyname' operator='eq' value='"+companyname+"' />";
fetchXml += "<condition attribute='leadid' operator='ne' uitype='lead' value='"+leadid+"' />";
fetchXml += "</filter>";
fetchXml += "</entity>";
fetchXml += "</fetch>";
Thanks!