Microsoft Dynamics AX 2012 R2 – Developer perspective on the Selection list

Extending the Selection list to other list pages

In a previous blog titled Microsoft Dynamics AX 2012 R2 – Selection List, I described how this simple feature can help you keep and manipulate a persistent selection on list pages for planned orders and production orders. In that blog I also mentioned that you can extend other list pages so that they can also use the Selection list feature. In this blog, I’ll provide developers with the specifics of just how to do that. I’ll also describe the foundation beneath the implementation of the Selection list.
During implementation, the conceptual name of this feature was Production Record Basket. This name became the ProdRecBasket prefix, which is assigned to the elements of the feature and will help us to locate the artifacts in the system that we’ll need for the extension.

 
Figure 1: The artifacts related to the Selection List

 

The Selection list is implemented in a context-agnostic manner. The feature recognizes only that records from the root data are displayed in the grid, and is neither domain specific nor dependent on the type of records it displays. One important note is that the Selection list works only with the source of the root data for the list page. The root data source for a form is easy to identify. It’s the one data source that has the Joins property clear and usually appears first on the list of data sources.

For this exercise, the most relevant artifacts to keep in mind are the following:

  1. The ProdRecBasket configuration key
    1. You must enable this configuration key to use the feature because it controls access to the table definitions and menu items.
  2. The Selection list button group
    1. These are buttons that need to add to the Action Pane of the list page that are the front-end UI for this feature.
      Their functions are detailed in the previous post. I recommend using the form ReqTransPOListPage as a data point to retrieve these.


      Figure 2: The Selection list buttons, as implemented in the ReqTransPOListPage form.

  3. The ProdRecBasketPart (the Selection List Factbox part)

    1. This is the form part to attach to the list page. It functions as the engine that
      supports the feature.

  4. The ProdRecBasketUse (the security privilege)

    1. This security privilege enables the user roles to read and write to the tables.

Using these four elements I’ll go through the process of extending another list page so that it consumes the Selection list.
For this example, I’ll use the EcoResProductListPage form.

My first concern is security. I must ensure that the user role can read and write to the selection list tables. I’ll start by locating the duties that are related to the Products form, which are EcoResProductDefinitionMasterInquire and EcoResProductDefinitionMasterMaintain. To these duties I’ll then add a reference to the privilege called ProdRecBasketUse.



Figure 3: Extending the duties for the Products list page to be able to use the Selection List.



Now that I’ve taken care of security, my next step is to add the buttons to the EcoResProductsListPage form. I’ll use the ReqTransPOListPage as the source of the metadata information. I’ll copy the button group from the planned orders list page, and paste it on the Action Pane of the Products list page. When you do this, please remember to change the metadata property called
DataSource to match the root data source of the form. In this case, the root data source of the Products form is called EcoResProduct.



Figure 4: Adding the selection list buttons to the Products list page.


The last step is to add the controlling fact box to the Products list page. I’ve just created it, but I also could have copied it from the Planned orders list page. Now that it’s added, I’ll align the metadata properties as shown in Figure 5.


Figure 5: Adding the Selection list part to the Products list page.

When the process is done, my Products list page should be ready for the Selection list.



Figure 6: The Products list page extended to support the selection list

Please make sure to add a comment or send me a message with any questions or concerns regarding this topic.

 

Andre Lamego,
reviewed by Brent Holtorf and Roxana Christina Diaconu

Microsoft Dynamics AX R&D