Modification of Inquiry Results: To Include an Additional Output Field
In this activity, you will learn how to modify an existing generic inquiry to include an additional column of data in the results grid.
Story
Suppose that you are a technical specialist in your company who is working on simple customizations, including those involving the creation, modification, and use of generic inquiries. An accountant of your company has requested an inquiry that displays data about invoices and memos. You have offered the predefined Invoices and Memos (AR3010PL) generic inquiry form. After reviewing this inquiry, the accountant has requested the following changes:
- Add the identifier of the related project (that is, the project related to the listed invoice) to the inquiry results in the column with the Project ID caption
- Add the ability to view the details of any project by clicking its identifier in the Project ID column
- Add the ability to filter the inquiry results by an identifier of a project
- Place the Project ID column after the column that holds the reference numbers of invoices and memos
Configuration Overview
You will work with a copy of the predefined Invoices and Memos (AR3010PL) inquiry form, which has the AR-Invoices and Memos inquiry title and the Invoices and Memos site map title specified on the Generic Inquiry (SM208000) form.
The copy you will work with has the DB1-ARInvoicesMemos inquiry title and the S130 Invoices and Memos site map title specified on the Generic Inquiry form.
Process Overview
In the Summary area of the Invoices and Memos (AR301000) form, you will inspect the Project/Contract element to find the related data access class (DAC) and data field. Then you will make changes to the copied inquiry on the Generic Inquiry (SM208000) form. You will add a data field on the Results Grid tab of the form.
System Preparation
Launch the MYOB Acumatica website, and sign in to a tenant with the U100 dataset preloaded as system administrator Kimberly Gibbs. You should sign in by using the gibbs username and the 123 password.
Step 1: Inspecting UI Elements
To discover the data access classes and data fields you will need to use in future steps, do the following:
- Inspect the Project/Contract element in the Summary area
of the Invoices and Memos (AR301000) form to find the
related data access class (DAC) and data field. For the exact steps to do this,
see DAC Discovery: To Inspect UI Elements.Tip: While you are working with a generic inquiry on the Generic Inquiry (SM208000) form, you may find it convenient to have the form or forms containing the UI elements open in a separate browser tab, so that you can quickly switch between the Generic Inquiry form and the form you are using to inspect the elements.
- Make a note of the discovered DAC and data field of the Project/Contract element (ARInvoice and ProjectID, respectively).
Step 2: Adding a Data Field, Changing the Caption, and Setting Up Default Navigation and Filtering
To add a column to the results grid of the existing inquiry, do the following:
- Open the Generic Inquiry (SM208000) form.
- In the Inquiry Title box of the Summary area, select DB1-ARInvoicesMemos.
- In the Site Map Title box of the Summary area, type Invoices and Memos with Projects.
- On the Data Sources tab, verify that the
PX.Objects.AR.ARInvoice
table is listed. This means that you do not need to add the table to retrieve project identifiers of invoices. - On the Results Grid tab, add a row, and specify the
following settings in the added row:
- Object: ARInvoice
- Data Field: ProjectID
Notice that the Visible check box is selected by default, which indicates that the system will display the added column in the inquiry. Also notice that the Default Navigation check box is selected by default, indicating that the values in this column will be shown as links, because the Projects (PM301000) form is specified for the data field as the default form defined in the source code. In the generic inquiry resulting from these changes, when a user clicks a link in this column, the system opens the Projects form in a pop-up window with the selected project details.
- In the Caption column (which is hidden by default), type the caption (name) of the requested column (Project ID).
- In the Quick Filter column (which is hidden by default), select the check box for the added row.
- On the form toolbar, click Save.
You have added the row that corresponds to the Project ID column. Currently, it is the last row, so Project ID would be the rightmost column on the generic inquiry form. In the next step, you will move the row so that the column appears in the needed place on the inquiry form.
Step 3: Moving the Rows and Previewing Your Changes
To move rows and preview the inquiry, do the following:
- While remaining on the Generic Inquiry (SM208000) form with the DB1-ARInvoicesMemos generic inquiry selected, again open the Results Grid tab.
- Drag the added row immediately after the row that holds reference number information (that is, the row with a Data Field setting of RefNbr).
- On the form toolbar, click Save.
- Click the eye icon on the side panel to preview how your changes have affected the DB1-ARInvoicesMemos inquiry (which has the Invoices and Memos with Projects site map title). Notice that the Project ID column has been added and placed after the Reference Nbr. column (see the following screenshot) so that an accountant can see the related projects while viewing the list of invoices and memos in the results grid.