Search code examples
axaptadynamics-ax-2012-r2

Dynamics AX 2012 R2 - swapping out a preview pane dynamically depending on the record selected


I have a problem I'm trying to solve and I'm really not sure I'm, A) solving it the correct way, and B) able to do what I want.

I have a List Page that is a basically a summary table (transportation table) that has a record in it for every Sales, Purchase, and Transfer order that we will ship. With it is a pile of rolled up information and such that's common from the 3 sources. We use this table on a few list pages and link out to where we need to. This was all built by someone else, but I'm maintaining some parts around it.

I've gotten a request to have the preview pane on a summary table based list page show the lines from the source order. So, if a "sales order" is selected in the grid, show the lines in the preview pane for the "sales order" that was selected. Same for a purchase order and transfer order.

So, my idea, based on pure ignorance and not a ton of experience with Dynamics is that I would just swap out the preview pane based on the source order. The SalesTableListPagePreviewPane for instance has already been updated to work with linking to this summary table. So, I wanted to just change the part reference at runtime.

I've managed to get the FormRun on a list page interaction class from the datasource. I've managed to get a list of the parts via the PartList object. But, I have no idea how to continue on to actually swap out a part reference.

Am I heading down the correct path? Is this a completely wrong Dynamics AX pattern?


Solution

  • Your assumption, that you can dynamically (run-time) change the parts of the form, is wrong.

    Listpages especially are quite static, the only code available through interaction classes. It has the benefit that a listpage can be easily deployed on Sharepoint Enterprise Portal.

    You have several options:

    1. Use 3 different listpages for each type of transport
    2. Use a common relation table with 3 sub-tables (sales, purchase and transfer)

    The last option will enable you to do an outer join on the 3 sub-tables. The common relation table could be a union view, but I doubt it will perform well.