Redirection to Webpages: To Add Redirection Links to the Grid by Using the PXSelector Attribute
This 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 so users can navigate to the entry form with the detailed information about the 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 for the invoice whose number the user has clicked. The user can then view the settings and make any needed modifications. You’ll add these links by configuring the TypeScript file of the form.
Process Overview
- Adding redirection links by using the PXSelector
attribute for the
InvoiceNbrDAC field - 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:
Step 1: Adding a Link by Using the PXSelector Attribute
In this step, you will add the redirection link to the Open Payment Summary (RS401000) form.
- Make sure that the DAC that holds invoice records has the PXPrimaryGraph attribute or its descendants declared on it. This DAC can be either ARInvoice or SOInvoice (which extends ARInvoice).
- In the
RSSVWorkOrderDAC, add the PXSelector attribute to theInvoiceNbrfield, as shown in the following code.[PXSelector(typeof(SearchFor<SOInvoice.refNbr>. Where<SOInvoice.docType.IsEqual<ARDocType.invoice>>))]The
RSSVWorkOrderToPayDAC, which is used on the Open Payment Summary form, inherits theInvoiceNbrfield, including its attributes. Because theInvoiceNbrfield of theRSSVWorkOrderDAC has the PXSelector attribute assigned, you can configure the same link for other forms where this DAC is used, such as the Repair Work Orders (RS301000) form.Tip: You can also add the PXSelector attribute in an extension of theRSSVWorkOrderDAC by using the PXMergeAttributes attribute. For details, see Customization of Field Attributes in DAC Extensions. - Add the necessary using directives.
- Build the project.
- In the RS401000.ts file, add the
CommitChanges property for the
InvoiceNbrfield.export class RSSVWorkOrderToPay extends PXView { OrderType: PXFieldState; OrderNbr: PXFieldState; Status: PXFieldState; InvoiceNbr: PXFieldState<PXFieldOptions.CommitChanges>; PercentPaid: PXFieldState; ARInvoice__DueDate: PXFieldState; ARInvoice__CuryDocBal: PXFieldState; } - Publish the customization project.
Step 2: Testing the Redirection Links
To test the redirection links that you’ve implemented, do the following:
- In MYOB Acumatica, open the Open Payment Summary (RS401000) form.
The form should look similar to the one shown below, with links shown in the Invoice Nbr. column.
Figure 1. The links in the Invoice Nbr. column 
- 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:The type of invoice determines which form may be opened:
- Sales invoice: Invoices (SO303000)
- AR invoice: Invoices and Memos (AR301000)
The logic that determines which form to open is embedded in MYOB Acumatica.
