Hi All,
I'm trying to add PreSearch on lookup field incase of an option in optionset field and trying to remove it on another option. Add is working fine but removePreSearch isn't
onChangeProductType: function (executionContext) {
var formContext = executionContext.getFormContext();
if (formContext.getAttribute("ab_producttype").getValue() == 108730002) {
formContext.getControl("ab_product").addPreSearch(function () {
filterlookup(executionContext);
});
}
else {
formContext.getControl("ab_product").removePreSearch(filterlookup);
}
},
filterlookup: function (executionContext) {
var formContext = executionContext.getFormContext();
var filter = "<filter type='and'><condition attribute = 'name' operator = 'like' value = '%Builders%' /><condition attribute='name' operator='like' value='%Single%' /><condition attribute='name' operator='like' value='%60%' /><condition attribute='name' operator='like' value='%Exterior%' /></filter>";
formContext.getControl("ab_product").addCustomFilter(filter);
},