Using these methods we can now easily filter the lookup in Dynamics 365.
Using addPreSearch we can specify a handler to PreSearch Event. Inside the handler we can specify our fetch xml query that can be used for filtering. The filter applied in the fetch xml will be combined with the any previously added filter as an ‘AND’ condition.
To remove the filter we can use removePreSearch method.
formContext.getControl(arg).addPreSearch(myFunction)
- Pass execution context
- Specify the argument which is nothing but the lookup field you want to addPresearch functionality.
Example:
formContext.getControl(“csz_consumedproduct”).addPreSearch(filterConsumedProductLookup);
function filterConsumedProductLookup(executionContext) {
debugger;
var entityLogicalName = “product”;
var filter = ” <filter>” +
” <condition attribute=’name’ operator=’not-like’ value=’%Accompanied%’ />” +
” </filter>”;
executionContext.getFormContext().getControl(“csz_consumedproduct”).addCustomFilter(filter, entityLogicalName)
}
Cheers,
PMDY
Cheers,
PMDY
I discovered your blog site on google and check a few of your early posts. Continue to keep up the very good operate. I just additional up your RSS feed to my MSN News Reader. Seeking forward to reading more from you later on!?
LikeLike
Heya just wanted to give you a quick heads up and let you know a few of the pictures aren’t loading properly. I’m not sure why but I think its a linking issue. I’ve tried it in two different internet browsers and both show the same results.
LikeLike
Hi my friend! I wish to say that this post is amazing, nice written and include approximately all important infos. I’d like to see more posts like this.
LikeLike
I really can’t believe how great this site is. Keep up the good work. I’m going to tell all my friends about this place.
LikeLike
I think this is among the most significant info for me. And i am glad reading your article. But want to remark on some general things, The website style is ideal, the articles is really great : D. Good job, cheers
LikeLike
I do agree with all of the ideas you’ve presented in your post. They are really convincing and will definitely work. Still, the posts are very short for novices. Could you please extend them a bit from next time? Thanks for the post.
LikeLike
Sure..thank you for letting know what you think…will elucidate..
LikeLike
It’s actually a cool and useful piece of information. I am glad that you shared this helpful information with us. Please keep us up to date like this. Thanks for sharing.
LikeLiked by 1 person