I have the following XML code that is filtering my Lookup Field in my Crm Dynamics form.
The filter is used following the data that is entered into the Account Field. However, the account field can contain the &
symbol, and when it does, an error occurs stating that the XML is not well formed.
Does anyone have any solutions to the problem?
function accountcontact()
{
Xrm.Page.getControl("new_contactlookup").addPreSearch(function () { addcontactlookup(); });
function addcontactlookup()
{
var accountID = Xrm.Page.getAttribute("new_companylookup");
var AccountIDObj= accountID.getValue();
if (AccountIDObj != null)
{
var fetchFilter1 = "<filter type='and'><condition attribute='parentcustomerid' uitype='" + AccountIDObj[0].entityType + "' operator='eq' value='" + AccountIDObj[0].id + "' uiname='" + AccountIDObj[0].name + "' /></filter>";
Xrm.Page.getControl("new_contactlookup").addCustomFilter(fetchFilter1);
}
}
}