Search code examples
formsaxaptadynamics-ax-2012

How to keep "Show in content area" when form is open by menuitem from code?


On few places in our application we open ListPage in content area. On the address line there is something like "Company/Module/Folder". On that listpages are menuitems which calls class which create menuitem and open the new ListPage form like:

Args args = new Args();
str param = 'Something';
MenuFunction openProjects = new MenuFunction('ListPageName',MenuItemType::Display);

args.parm(param);
openProjects.run(args);

When it called like that the address degenerate to "Company/"

Normally the display of that path depends on property "IsDisplayedInContentArea=Yes" on menu but I do not know how to set this in code.

How to keep the location (at least when the same ListPage is just reopen with different parameters)?

I am using Microsoft Dynamics AX 2012R2.


Solution

  • It happens when the menuitem which is not in any menu is used. So the solution is use menuitem which exist somewhere in the menu.

    I also see this behavior when the callers args are used instead of creating new Args() like:

    public static void main (Args _args) {
    MenuFunction openProjects = new MenuFunction('ListPageName',MenuItemType::Display);
    _args.param('Something');
    openProjects.run(_args);
    }