Redirection to Webpages: To Add Redirection Links to the Grid by Using the PXSelector Attribute

The following activity will walk you through the process of adding redirection links to the grid of a form by using the PXSelector attribute.

Story

Suppose that you want to improve the navigation between the rows of the grid on the Open Payment Summary (RS401000) form and the invoices listed in these rows. You plan to do this by adding redirection links to give users the ability to navigate to the entry form with the detailed information about the sales invoice.

You need to replace the text numbers in the Invoice Nbr. column with links that a user can click to open the data entry form, Invoices (SO303000), for the sales invoice whose number the user has clicked. The user can then view the settings and make any needed modifications. You will add these links by configuring the ASPX file of the form.

Process Overview

In this activity, you will add redirection links to the Invoice Nbr. column of the Open Payment Summary (RS401000) inquiry form by performing the following steps:
  1. Adding redirection links by using the PXSelector attribute inside a RowTemplate element in the ASPX file of the form
  2. On the Open Payment Summary (RS401000) form, testing the redirection links to make sure they redirect the user to the Invoices (SO303000) form with the record selected

System Preparation

Make sure that you have completed the steps described in the following prerequisite activities:

  1. Test Instance for Customization: To Deploy an Instance for Developing Inquiry Forms
  2. Inquiry Forms: To Set Up an Inquiry Form
  3. Filtering Parameters: To Add a Filter for an Inquiry Form
  4. Data View Delegates: To Add a Filtering Query Dynamically
  5. Data Aggregation: To Retrieve Aggregated Data
  6. Use of PXProjection: To Display Multiple DAC Data on a Tab

Step 1: Adding a Link by Using the PXSelector Attribute

To add a redirection link by using the PXSelector attribute, do the following:
  1. Make sure that the DAC that holds invoice records has the PXPrimaryGraph attribute or its descendants declared on it. The DAC that holds invoice records can be either ARInvoice or SOInvoice (the DAC that extends from ARInvoice).
  2. In the RSSVWorkOrder DAC, add the PXSelector attribute to the InvoiceNbr field as shown in the following code.
            [PXSelector(typeof(SearchFor<SOInvoice.refNbr>.
                Where<SOInvoice.docType.IsEqual<ARDocType.invoice>>))]

    The RSSVWorkOrderToPay DAC, which is used on the Open Payment Summary form, inherits the InvoiceNbr field, including its attributes. Adding the PXSelector attribute to the RSSVWorkOrder DAC can later allow to configure the same link for other forms where this DAC is used such as the Repair Work Orders (RS301000) form.

    Note: You can also add the PXSelector attribute to the extension of the RSSVWorkOrder DAC by using the PXMerge attribute. For details, see Customization of Field Attributes in DAC Extensions
  3. Add the necessary using directives.
  4. Build the project.
  5. In the RS401000.aspx file, add the CommitChanges="True" property to the PXGridColumn object for the InvoiceNbr column.
  6. In the PXGridLevel container, add the RowTemplate element and add the PXSelector element inside it, as shown in the following code.
              <RowTemplate>
                <px:PXSelector ID="edInvoiceNbr" runat="server"
                    DataField="InvoiceNbr" AllowEdit="True" />
              </RowTemplate>
  7. Publish the customization project.

Step 2: Testing the Redirection Links

To test the redirection links that you have implemented, do the following:

  1. In MYOB Acumatica, open the Open Payment Summary (RS401000) form.

    The form should look similar to the one shown in the following screenshot. Notice that links are shown in the Invoice Nbr. column.

    Figure 1. The links in the Invoice Nbr. column


  2. In any row with a repair work order (that is, any row with Order Type set to WO), click the invoice number.
    The Invoices (SO303000) form should open in a new window with the invoice displayed.
    Tip: Depending on type of the invoice, the Invoices and Memos (AR301000) form may be opened instead of the Invoices form. The logic that determines which form to open is embedded in MYOB Acumatica.