Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

removePreSearch Lookup

$
0
0

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);

},


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>