Search code examples
axaptadynamics-ax-2012dynamics-ax-2012-r2

How to pass arguments to the ListPageInteraction class?


I would like to change behavior of list page based on the menuitem which call is. I know I am able to call ListPage with different queries but I wan to go little further and have ListPage with different ListPageInteraction class or with ListPageInteraction class where I can have some arguments from menuitem which calls it. How can I do it?

I am adding range on ListPageQuery in ListPageInteraction class dynamically in initializeQuery method based on user which calls the list page.

I know I can have a duplicate of a ListPage with different ListPageInteraction assigned or I can artificially add some information to the _query but it does not seems right.

P.S.: Why there is no _args input?


Solution

  • The is an args input, check the SysListPageInteractionBase class, in the initializing method the args object is retrieved:

    this.setListPageType(this.listPage().listPageArgs());
    

    You change the query based on this, check the ReturnTableListPageInteraction.setModeledQueryName() method for example:

    switch (this.getListPageType())
    {
        case ReturnTableListPageType::Main:
            // Don't change query
            break;
    
        case ReturnTableListPageType::Open:
            this.listPage().modeledQueryName(querystr(ReturnTableListPage_Open));
            break;
        [...]
    }