How to extend existing search criteria for full-text search within Retail and Commerce
Microsoft Dynamics 365 has built in full-text search functionality when searching for customers, products, and prospects. Dynamics 365 builds full-text indexes over a large volume of the text data, which contains vital words and locations, and results in faster search. When creating a sales order; the full-text search can help expedite searching for customers and items based on configured criteria (e.g., customer account, phone, zip code, product name). This article covers configuring, utilizing, and customizing full-text functionality.
In this example, we will use the Contoso Retail USA (USRT) company.
Configure the Search Criteria
Navigate to Sales and marketing > Setup > Search > Search criteria
- From the dropdown in the action pane, select Customer. Add new rows for MCRCustomerSearchViewselecting AcccountNum, City, Name, Street, and ZipCode fields one by one:
- Click Update search data, and click on Yes to the following message:
- Select the Customer option from the Source dropdown box and click on OK:
Repeat the steps above for Product selection in the action pane but use MCRProductSearchView.
Configure Search Parameters
Navigate to Sales and marketing > Setup > Search > Search parameters:
Limit number of results to: Number of records to display from the search result, set to 50.
Search type: Select the Partial match option.
Automatically fill customer search: This option allows you to automatically select the Customer; if only one customer is found as a search result, set to No.
Automatically fill item search: This option allows you to automatically select the item if only one; item is found as a search result, set to No.
Save search type: This option will allow saving search type; set to Yes.
Enable lookup for product search: This option will allow the field lookup for the product search; set to Yes.
Perform Customer Search
Navigate to Retail and Commerce > Customer > Customer service
You will need to use the Keyword option to find customers using full-text search. Enter the criteria and click the Search button:
The results are shown in a new prompt which allows for updating the search criteria:
Customizing the Full-text Search for Customer
Many times, there is a business requirement to add more fields to full-text search criteria so that a search can be performed across more columns and tables. Let’s review an example where we add the primary phone number as part of a keyword search.
- Extend the MCRCustTableSearch query:
Add LogisticsElectronicAddress table to the DirPartyTable data source. Relationship: DirPartyTable.PrimaryContactPhone == LogisticsElectronicAddrss.Recid Fetch Mode: OneToN Join Mode: OuterJoin Dynamics Fields: Yes - Extend the MCRCustomerSearchView view:
Add LogisticsElectronicAddress.Locator (phone number) to the field list. Note: Database sync is required before updating the customer search configuration.
Update Configuration Based on Customizations
Navigate to Sales and marketing > Setup > Search > Search Criteria
- Add Locator to the search criteria grid
- Click on the Update Search Data menu and update the Customer search data as explained before.
Search the Customer by Primary Phone
Navigate to Retail and Commerce > Customer > Customer service
From the drop-down menu, select the Keyword option and enter the primary phone number to search for a customer:
The results are shown in a new prompt which allows for updating the search criteria:
In this blog, we have introduced full text search for Dynamics 365, and its configuration and usability. We have also shown how to extend this functionality with additional search criteria.
Deep Expertise in Dynamics AX and D365 Development
enVista is dedicated to helping the Microsoft community by continuously sharing our in-depth knowledge of X++ and Microsoft Dynamics 365 development. If you are struggling with Dynamics AX or D365 development, contact us, and we will connect you with one of our in-house experts.
Read our other topics in our D365 Developer Series: