AX / D365FO – How To Call A Form Using X++

Inside my form I want to open another form. To achieve this goal without writing code I can use a Display Menu item, but I can also use a normal button to open it.

Using a normal button requires write some X++ code.

First create a button on your form’s Button group

Then override clicked() method

Use this example to open the form


    [Control("Button")]
    class FormButtonControl1
    {
        /// <summary>
        ///
        /// </summary>
        public void clicked()
        {
            Args    args;
            FormRun formRun;

            super();

            //Call the form directly.
            Args = new Args(formStr(ots_GuidedSalesOrderEntryRulesZTEST)); //Write your form name here
            
            formRun = New FormRun(Args);
            formRun.init();
            formRun.run();
        }
    }

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 )

Facebook photo

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

Connecting to %s