Filtering Parameters: To Display the Filter Values in the URL
When a form contains filtering parameters, it is sometimes useful to have the selected parameter values in the form URL so that the same form (that is, the form with the same selections made) can be opened elsewhere without the filter parameter values needing to be entered again.
Story
Suppose that the users of the custom Open Payment Summary (RS401000) inquiry form would like to easily share filtered inquiry results with other users by just sharing a link to the form without specifying which values need to be selected. You need to implement these functionality for the form.
Process Overview
You will implement this behavior by adding the PageLoadBehavior
attribute and setting its value to PopulateSavedValues
in the
PXDataSource control in the ASPX page of the form. The filter
values of the primary view will be placed in the form URL. You will then test the
implemented behavior.
System Preparation
Before you begin performing the steps of this activity, do the following:
- Prepare an MYOB Acumatica instance by performing the Test Instance for Customization: To Deploy an Instance for Developing Processing Forms prerequisite activity.
- Create an inquiry form without filtering parameters by performing the Inquiry Forms: To Set Up an Inquiry Form prerequisite activity.
- Add filtering parameters to the inquiry form as described in Filtering Parameters: To Add a Filter for an Inquiry Form prerequisite activity.
Step 1: Displaying the Filter Values in the URL of the Inquiry Form
To display the filter values in the URL of the form, do the following:
- In the RS401000.aspx file, find the PXDataSource control.
- Add the PageLoadBehavior attribute value to the
PXDataSource control, as the following code
shows.
<px:PXDataSource ID="ds" runat="server" Visible="True" Width="100%" TypeName="PhoneRepairShop.RSSVPaymentPlanInq" PageLoadBehavior="PopulateSavedValues" PrimaryView="Filter" >
The system inserts into the URL the filter values of the primary view only (in this case, the values of the
PXFilter<RSSVWorkOrderToPayFilter> Filter
view). - Publish the customization project.
Step 2: Testing the Filtering Parameters of the Inquiry Form
In this step, you will test the Open Payment Summary (RS401000) inquiry form with the filtering parameters. To test the filtering parameters, do the following:
- In MYOB Acumatica, open the Open Payment Summary (RS401000) form.
The form should look as shown in the following screenshot. Notice that the form contains a form toolbar, the Selection area with UI elements that correspond to the filtering parameters, and a table with a toolbar.
- On the Repair Work Orders (RS301000) form, do the following:
- Create a repair work order, and specify the following settings:
- Customer ID: C000000003
- Service: Battery Replacement
- Device: Nokia 3310
- Description: Battery replacement, Nokia 3310
- On the form toolbar, click Remove Hold, Assign, Complete, and Create Invoice.
- Create a repair work order, and specify the following settings:
- On the Open Payment Summary form, in the Customer ID box,
select C000000001.
The table displays work orders for the C000000001 customer. Notice that the page URL (shown below) includes the form ID and customer ID values.
http://localhost/SmartFix_T250/Main?ScreenId=RS401000&CustomerID=C000000001
- In the Service ID box, select the Battery
Replacement service.
The table now displays the work orders for the C000000001 customer and the Battery Replacement service. Notice that the page URL (shown below) contains the form ID, customer ID, and service ID values.
http://localhost/SmartFix_T250/Main?ScreenId=RS401000&ServiceID=1&CustomerID=C000000001
This URL can be copied and shared with other users.
- On the form toolbar, click Cancel.
Notice that the boxes in the Selection area have been cleared and that the URL no longer includes the filter values.