Search Customization: General Information

MYOB Acumatica provides universal search capabilities, which are described in detail in Search Capabilities: General Information. With this search, a user can find the records of data access classes (DACs) whose data matches the text entered in the search box.

Learning Objectives

In this chapter, you will learn how to customize the universal search in MYOB Acumatica.

Applicable Scenarios

You customize the universal search in the following cases:

  • You need to implement a search for a record in the system by the value of a new DAC field that you have added. For example, you need to implement the search for a document by the value of its external reference number.
  • You have added a new DAC and you need the records of this DAC to be available in the universal search results.

Search in DACs

The DAC search results are displayed on the Documents and Transactions tab (shown below). Each result includes the following lines:

  • The title (the blue text in the screenshot below)
  • The first information line (optional)
  • The second information line (optional)
Figure 1. Results of DAC search


Requirements for a DAC

A DAC record can be displayed in the search results if the DAC meets the following requirements:

  • The DAC is marked with the PXPrimaryGraph attribute or another attribute derived from the PXPrimaryGraphBaseAttribute class. The system uses this attribute to provide navigation to search results. The records of the DACs that do not support this navigation are not included in the search results.
  • The DAC has the NoteID field, which is marked with the PXNote attribute.

    The NoteID field is the main and unique identifier of any record in the MYOB Acumatica database.

    Important: The name of the DAC property field that has the PXNote attribute must be NoteID. This name is case-sensitive.
  • The NoteID field of the DAC has the PXSearchable attribute declared on it.
  • The DAC is present in the search index.

    To add a DAC to a search index, you should rebuild the search index. For details, see Search Indexes: To Rebuild Search Indexes.

    Important: You should rebuild the search index after every database upgrade.
  • Optional: The DAC is marked with the PXCacheName attribute. This attribute defines the name that is displayed for the DAC on the Rebuild Full-Text Entity Index (SM209500) form.

PXSearchable Attribute

You use the PXSearchable attribute for the following purposes:

  • To specify the DAC fields that the system will use to build search index (see the fields, titlePrefix, and titleFields parameters in the attribute constructor and the NumberFields property).
  • To specify format of the search result (see the titlePrefix and titleFields parameters of the attribute constructor and the Line1Format, Line1Fields, Line2Format, and Line2Fields properties of the attribute).
  • To configure access restrictions (see the SelectDocumentUser property).
  • To configure row-level security (see the MatchWithJoin property).
  • To specify conditions that determine whether the DAC is displayed in the search results (see the WhereConstraint property).

You can find an example that uses basic properties of this attribute in Search Customization: To Display a DAC in Universal Search Results. You can find more examples in the API Reference (see PXSearchable).

Examples in MYOB Acumatica Source Code

You can find examples of the implementation of the DAC search in the following DACs in the MYOB Acumatica source code:

  • PX.Objects.AP.APInvoice, which is used on the Invoices (SO303000) form
  • PX.Objects.SO.SOOrder, which is used on the Sales Orders (SO301000) form