As you may know, DisplayText Data Attribute was introduced in version 2022.
The value of DisplayText attribute is the display text of the domain object- i.e. its text representation. It's widely used when you want to visualize an object directly, without the need to manage which attributes to include, to format them, etc. The most relevant example of the use of display text attribute is the drop-down menus in the web client.
Search in DisplayText
Search now works for display text as well.
What does that mean?
This means that if the default search members for an entity don't fit you, you can introduce additional ones via display text format for the entity.
Let's see this in action.
One of the most common display format for the customers entity is the following one,
{Party.PartyName:T} #{Number}
I.e., will visualize the name of the corresponding party and the customer's number. Just as the first picture from above. If, for example, you also want the party unique number to become part of the display text, just edit the display text format like this:
{Party.PartyName:T} / #{Number} / {Party.PartyUniqueNumber}
As a result, the customers' drop-down menus will look like in the picture below:
And the most important detail,
You can now also search in the party unique number.
Domain API
The same is also valid for the Domain API. You don't need to do anything extra. Just use the $search query option as usual and the search will be performed in the defined attributes, part of the display text format.
The following query,
~/api/domain/odata/Crm_Customers?$select=Number&$expand=Party($select=PartyName,PartyUniqueNumber)&$search="121"
Will return a result as the picture from above:
{ "@odata.context": "~/api/domain/odata/$metadata#Crm_Customers", "value": [ { "@odata.id": "Crm_Customers(a87c53a8-ee2a-481c-a23c-0506389c16ac)", "Number": "00006", "Party": { "@odata.id": "General_Contacts_Parties(74a68001-642c-49e8-a124-a1e8daf6feea)", "PartyUniqueNumber": "121084091", "PartyName": { "EN": "ERP Bulgaria Ltd", "BG": "И Ар Пи България ООД" } } } ] }
---
More information is available in our official documentation:
https://docs.erp.net/dev/domain-api/query-options/search.html
https://docs.erp.net/tech/advanced/data-objects/display-format.html#searchable
https://support.erp.net/hc/en-us/articles/4414888410130
0 Comments