FILTER LOOKUP IN DYNAMICS 365 BASED ON CONDITION IN JAVASCRIPT WITH ADDCUSTOMFILTER AND ADDPRESEARCH
Working with lookups in Dynamics 365 can provide you with many possibilities to filter the records displayed in the lookup. While you can use the out-of-the-box related records filtering in the lookup field properties, this might not be sufficient in some scenarios. Therefore, in such cases, writing JavaScript code is mandatory to achieve what you want, which is the topic of this post. In this tutorial, you will learn how to filter a lookup field in Dynamics 365 based on a condition using the addPreSearch and addCustomFilter functions.
The post outlines the process step-by-step, detailing how to create a fetch XML with a filter, use the account category as a condition to filter the list of available accounts in the parent account lookup, add the addPreSearch function on form load, and then use the addCustomFilter function to filter the lookup based on the condition you set. The post also provides sample JavaScript code to make the process clear.
By following the steps mentioned in the tutorial, you will be able to filter a lookup field in Dynamics 365 based on a condition using JavaScript effectively. You can go ahead and apply the addPreSearch and addCustomFilter functions to your Dynamics 365 application according to your specific requirements.
Hope this helps!
Published on:
Learn moreRelated posts
Fetch Parent account information based on Selection of Child
This post discusses a useful technique to fetch parent account information based on the selection of a child account. While working with recor...
How the “Regarding” field works in Microsoft Dynamics 365 CRM and the process for adding a custom entity to the “Regarding” lookup field.
Microsoft Dynamics 365 CRM is a powerful tool that allows you to associate records with other entities through the use of the "Regarding" fiel...
Filter Related Records with addPreSearch() | Model Driven App
In this experiment, the author attempts to combine the addPreSearch() method in the Client API with the recently documented FetchXml functiona...
Custom Lookup Filtering In Basic Forms – Power Pages
In this blog we will see how to use custom lookup filtering in basic forms. Basic forms in power pages with lookup fields often face issue wit...
Filter child lookup by parent lookup value in Power Pages Form
Check out this informative video on how to filter child lookup by parent lookup value in Power Pages Form. The video covers the following: - ...
How to Filter MS CRM Lookup with Custom Conditions Using JavaScript?
In the world of customer relationship management, Microsoft Dynamics CRM is a popular platform that offers businesses the ability to effective...
Power Apps Model Driven Apps: Cascading and Filtering Lookups Tutorial
This video serves as an essential guide for anyone working with Power Apps Model-Driven Apps and aims to make the process of configuring looku...
Expanding Lookup and filtering based on a value in related Entity - Web API roadblock
If you're looking to expand lookup and filtering based on a value in a related entity, this tutorial might be helpful. However, the author enc...
Related Record Filtering with the Lookup Dropdown PCF
A new feature has been added to Dataverse's LookupDropdown PCF control that allows for related record filtering. This means that dropdown valu...