
I am trying to filter the lookup based on some conditions and hence using addPreSearch. I am using the following code,
function filterLookup() {
debugger;
try {
var conditionalattribute= Xrm.Page.getAttribute("vrp_conditionalattribute").getValue();
if (conditionalattribute!= null && conditionalattribute!= undefined)
{
Xrm.Page.getAttribute("filteredattribute").addPreSearch(function () {
addLookupFiler();
});
}
}
catch (e) {
console.log(e.Message);
}
}But I am getting below error on addPreSearch line
Please note that I am using CRM v8.2.
Hi Partner,
Now the "addPreSearch" has been moved to formContext.getControl();
Please try "formContext.getControl(arg).addPreSearch(myFunction)".
Regards,
Leo