Skip to main content

Notifications

Dynamics 365 Community / Blogs / The Dynamics 365 Library / Calling/Opening AX form thr...

Calling/Opening AX form through X++

Faisal Fareed Profile Picture Faisal Fareed 10,794 User Group Leader
Sample piece of code to open AX form through X++

static voidOpenForm_ThroughCode(Args _args)
{
    Args                            args;
    Object                          formRun;

    // open form
    args = new Args();
    args.name(formstr(FormName));
    formRun = classfactory.formRunClass(args);
    formRun.init();
    formRun.run();
    formRun.wait();
}

If you want to pass a record to open a form

args = newArgs();
args.record(ProjTable::find('PR00001'));
args.name(formstr(FormName));
formRun = classfactory.formRunClass(args);
formRun.init();
formRun.run();

formRun.wait();

How to retrieve these args on caller form's init()

public voidinit()
{
    ProjTable   projTableLocal;   
    super();   
    projTableLocal = element.args().record();   
}

Comments

*This post is locked for comments