Hi All ,
I was trying to filter account name lookup based on the address1_city field value change on contact form using the below code .
function filterAccountLookup() {
try { if (Xrm.Page.getControl("address1_city") != null && Xrm.Page.getControl("address1_city") != undefined) { Xrm.Page.getControl("parentcustomerid").addPreSearch(function () { addCustomLookupfilter(); }); } } catch (e) { throw new Error(e.message); } } function addCustomLookupfilter() { try{ var city = Xrm.Page.getAttribute("address1_city").getValue(); if (city != null && city != undefined) { fetchxml = "<filter type='and'>" + "<condtion attribute='address1_city' operator='eq' value = '" + city + "' />" + "</filter>"; Xrm.Page.getAttribute("parentcustomerid").addCustomFilter(fetchxml, "account" ); } } catch (e) { throw new Error(e.message); } }
But i was getting error "Xrm.Page.getAttribute(...).addCustomFilter is not a function"
in function addCustomLookupfilter() at line
Xrm.Page.getAttribute("parentcustomerid").addCustomFilter(fetchxml, "account" );
Kindly help on this.
*This post is locked for comments