This post is machine-translated. The original post in german language can be found here.

Open form through code and modify query of form

The following code opens form VendTable in grid and modifies the query of the form. In the example three specific vendors should be shown.

static void openFormGridWithQuery(Args _args)
{
    Args args;
    FormRun fr;
    QueryBuildDataSource qbds;
    FormDataSource fds;
    QueryBuildRange qbr;

    args = new Args(formStr(VendTable));
    args.caller(null);

    args.menuItemType(MenuItemType::Display);
    args.menuItemName(menuitemDisplayStr(VendTable));
    args.formViewOption(FormViewOption::Grid);

    fr = classfactory.formRunClass(args);
    fr.init();
    fds = fr.dataSource();
    qbds = fds.queryBuildDataSource();

    qbds.addRange(fieldNum(VendTable, RecId)).value(queryValue(22565421239));
    qbds.addRange(fieldNum(VendTable, RecId)).value(queryValue(22565421240));
    qbds.addRange(fieldNum(VendTable, RecId)).value(queryValue(22565421714));

    fr.run();
    fr.detach();
}

The form opened by above job may look similar to the following screenshot:

Screenshot

These post applies to following version:
Dynamics AX 2012

Add comment
 
 

 

 
 
 
Posts of the actual month
Mai 2024
MoTuWeThFrSaSu
 12345
6789101112
13141516171819
20212223242526
2728293031 
 
© 2006-2024 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.