Create Runtime form control and get the value in Ax 2012

public void init()
{
super();
element.addControlAtRuntime();
}

private void addControlAtRuntime()
{
FormButtonControl formButtonControl;
FormComboBoxControl formComboBoxControl;
formButtonControl = this.design().addControl(FormControlType::Button, “DynamicButtonControl”);
formButtonControl.text(“Dynamic Button Control”);
this.controlMethodOverload(true);
formComboBoxControl=this.design().addControl(FormControlType::ComboBox,”JKCombobox”);
formComboBoxControl.items(3);
formComboBoxControl.item(1);
formComboBoxControl.text(“John”);
formComboBoxControl.item(2);
formComboBoxControl.text(“Krish”);
formComboBoxControl.item(3);
formComboBoxControl.text(“The Great”);
this.controlMethodOverload(true);

}

void DynamicButtonControl_Clicked(FormButtonControl _formButtonControl)
{
;
info (“Dynamic button clicked!”);
}

void JKCombobox_Modified(FormComboBoxControl _formComboBoxControl)
{
Bill_TabMethod btm;
FormComboBoxControl cb=element.controlCallingMethod();
info(cb.valueStr());
// select btm where btm.CustName==cb.valueStr();
//info(btm.ItemName);
}

OUTPUT:

RuntimeControl

Advertisements

3 comments on “Create Runtime form control and get the value in Ax 2012

  1. Pingback: Create Runtime form control and get the value in Ax 2012 - Microsoft Dynamics AX Community

  2. Hello,
    In dynamics ax 2012 “The FormRun object could not be created”
    code:
    void GNP_VendInvoiceJourAddData_Clicked(FormButtonControl _formButtonControl)
    {
    DictTable dictTable;
    Form formAddData;
    FormBuildDataSource fbDatasource;
    FormRun formRun;
    Args args;
    ;
    dictTable = new DictTable(tableNum(GNP_VendInvoiceJourAddData));
    formAddData = new Form();
    formAddData.name(“GNP_VendInvoiceJourAddData”);

    fbDatasource = formAddData.addDataSource(dictTable.name());
    fbDatasource.table(dictTable.id());
    args = new Args();
    args.object(formAddData);
    formRun = classFactory.formRunClass(args);
    formRun.init();
    formRun.run();
    formRun.detach();
    }

    stop code in “FormRun formRunClass(xArgs args)”
    Please help.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s