I have two entities: First I have 'contact' entity which contains both individuals and employees of company. I also have entity type 'account' which represents companies in my crm system.
I want to add filter to my customer search that contains:
This is working only for contacts individual's:
var fetchXml = "<filter><condition attribute='customertypecode' operator='eq' value='1' /></filter>";
Xrm.Page.getControl("customerlookupfield").addCustomFilter(fetchXml);
But I also want it to show companies (account entity), could you help?
Instead have 2 filters & add it to respective custom filter. Hence search result will be filtered.
var contactFilter = "<filter type='and'><condition attribute='customertypecode' operator='eq' value='1' /></filter>";
var accountFilter = "<filter type='and'><condition attribute='accountid' operator='not-null' /></filter>";
Xrm.Page.getControl("customerlookupfield").addCustomFilter(contactFilter, "contact");
Xrm.Page.getControl("customerlookupfield").addCustomFilter(accountFilter, "account");