With a large amount of data collected by companies in the system like items, customers, prospects, they need fast and convenient ability to search. For instance, when you are creating the sales order, you have to find the right product/customer from the list. Full-text search is a great way to simplify the search by examining all of the entities (products, customers, prospects) and matching search criteria to what you have typed in.
The objective of this article is to describe how to leverage D365 capabilities for full-text search.
There are several configurations that should be done in order to work with this feature:
Search parameters
Go to Sales and marketing > Setup > Search > Search parameters.
Number of results: the maximum number of records returned for the search
Automatically fill customer search flag: if only one result is found for the customers through the search, that result will be automatically selected.
Automatically fill item search flag: if only one result is found for the items through the search, that result will be automatically selected.
Search type has 2 options:
Partial Match: if search result is partially match, that result will be returned
Full match: only if search result is fully match, that result will be returned
Select Yes in the Automatically fill customer search field.
Select Yes in the Automatically fill item search field.
Select Yes in the Enable lookup for product search field.
Click Save.
Search criteria
Go to Sales and marketing > Setup > Search > Search criteria.
This setup is used to set the fields (one or multiple) which you will be using for in-line search.
There are three entities where you can configure the search criteria:
- Customer
- Product
- Prospect
Click Product to view product search criteria.
It’s predefined search criteria for usmf demo data. We are going to add additional criteria to search products by vendor account.
Click New.
In the Field name field select PrimaryVendorId value.
We will be searching products by Vendor account that is set on the product.
Click Update search data button to update view.
In the Search criteria page, click Customer.
You will see the list of fields that already part of the search engine for customers search.
Click New.
In the Field name field select VATNum value. We will be searching customers by VAT number that is set on the customer.
Do not forget to Refresh search view, once you have completed configuration by clicking Update search data button.
Let’s configure our test data.
We will set specific VAT number on the customer and Vendor on the product.
Go to Customer and make sure that VAT is set.
Go to Product and make sure that Vendor is set.
Walkthrough:
Go to Sales and marketing > Sales orders > All sales orders.
Click New.
In the Search by field there is Keyword option. This option uses full text search engine. All other options just search customers by particular value (like by phone number, customer name etc.).
In this field customers search criteria are used.
Type in VAT number that we set for the customer.
Click Search icon.
You will notice that Customer account is populated automatically.
Since there is only 1 match (only 1 customer with this VAT number), it’s get populated automatically (Automatically fill customer search flag is set to yes in the parameters)
Let’s type in another text that you would like to start searching on.
Click Search icon.
The list of matched customers will open.
Let’s start reviewing item search.
Go to the sales line detail section.
In the Item number field, type a value.
If there is not an exact match on the fields that you are searching on, then the Item Search dialog will be displayed showing you all of the matches.
You can notice that search results are limited by Number of results set on the Search parameters. In our case it’s 50 records.
You can further refine the search until you find the product that you want. We have added primary vendor id into our search criteria, so add US-101 vendor into search and watch out the result.
You can add the found product to the order line by typing in a Sales Quantity and then clicking the Create button.
Refresh the Sales order page.
That’s all!
Hi Galyna, thanks for this clear explanation. Really helpful. I have 1 question. When searching on ‘us-101 speaker’, the result is all speakers with primary vendor us-101. However, when I type ‘speaker us-101’ nothing is found. Why does the order of search values matter?
LikeLike
Hi Rene,
Let me try to explain it. Yes, the order matters. Unfortunately, I have example only for AX 2012 right now. But the logic is the same for D365. AX has the mcrInventTableIndex table. In this table there are several fields and 1 of them is SeachText . SeachText field contains all values used for the search.
If you write a simple job and review the values in the SeachText field, you will see:
static void SelectInvValue(Args _args)
{
MCRInventTableIndex mcrInventTableIndex;
ttsBegin;
while select SearchText from mcrInventTableIndex
{
info(strFmt(“%1”,mcrInventTableIndex.SearchText));
}
ttsCommit;
}
Result:
US-101 MidRangeSpeaker
US-101 Cabinet
US-101 StandardSpeaker
US-101 MidRangeSpeaker2
US-101 Wiring Harness
US-101 Mid-Range Speaker Unit
US-101 Tweeter Speaker Unit
US-101 Crossover
US-102 Enclosure
US-102 Binding posts
US-101 Standard Cabinet
US-102 Protective Corners
US-101 High End Cabinet
US-104 Car Audio Unit
US-104 Door Speaker Unit
US-104 Bass cabinet
US-104 Subwoofer
US-105 Amplifier
US-105 Coupe Wiring Harness
US-105 Sedan Wiring Harness
US-105 Convertible Wiring Harness
JP-001 Polyol
….
Next it’s only technical part:
When you are searching by Vendor and Product name, AX uses the select:
SELECT * FROM MCRInventTableIndex(MCRInventTableIndex_1) WHERE ((SearchText LIKE N’*us-106 speak*’)) and successfully display the result.
If you are searching by Product name and Vendor, AX cannot find the value which starts from speak
SELECT * FROM MCRInventTableIndex(MCRInventTableIndex_1) WHERE ((SearchText LIKE N’*speak us-106*’))
I hope it makes sense.
LikeLike
Howdy! I just would like to give an enormous thumbs up for the nice data you could have right here on this post. I will be coming again to your blog for extra soon.
LikeLike
Great explanation!
LikeLike
Great Explanation indeed :)! Thank you for your article. It works fine, only one issue with the SalesQuotation.
We have prospects and customers in our environment. When a sales employtee searches for a company, I hoped the search function would return a prospect or customer. For customers this works fine, but when I enter a prospect name it searches and returns a dialog which asks me to convert a prospect to customer. Do you know how to solve this? Thanks in advance!
LikeLike
Excellent working – Thanks so much for this.
with respect to ‘Product search -D365′ functionality, It seems apart from Product number and Name, etc. You can define search based on “Product variant, but it is limited to one variant.
You can search based on variant “Configuration’ only, and you could not search based on ‘Size,’ ‘Color,’ and ‘style.’
is my understanding is correct? please advise.
LikeLike