web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Create a button in a RunBaseBatch through x++

(0) ShareShare
ReportReport
Posted on by 2,894

Hi, I need to add a button in a RunBaseBatch class that I have created, and assign it a clicked method, could you give me an example on how to do it? thanks!

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    dolee Profile Picture
    11,279 on at

    Hi,

    Standard RunbaseBatch framework doesn't provide support for adding a button or click method.

    If you can present the options in a combobox drop down instead, it is possible to override the modified method of the combobox control to achieve similar results.

    Here's an example: devexpp.blogspot.hk/.../dynamics-ax-custom-lookup-in-dialog.html

  • Suggested answer
    Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    Instead of a simple button with clicked(), use a menu item button. You can add it to dialog by Dialog.addMenuItemButton().

    You'll find an example in BatchInfo.dialog().

  • saman0suke Profile Picture
    2,894 on at

    That's what I just did, however I need a way to pass it parameters, which I think is not possi ble through this way right? thanks!

  • Suggested answer
    Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    You can easily get a reference to your batch class - and it's all what you need! All other parameters can be exposed by public methods of the class.

    It's as easy as this:

    DialogRunBase dialog = _args.caller();
    MyBatchClass myBatchClass = dialog.runBase();
    myBatchClass .parmMyParameter();
  • Suggested answer
    Matt Vail Profile Picture
    30 on at

    This can actually be done without a MenuItem (see below) but I would recommend isolating any logic in a class or to use the SysOperationFramework instead.

    Object dialog()
    {
        DialogGroup     mainGroup;
        DialogRunbase   dialog = super();
    
        FormBuildControl dialogGroupControl;
        FormBuildButtonControl myButton;
    
        mainGroup = dialog.addGroup("Group");
    
        dialogGroupControl = dialog.formBuildDesign().control(mainGroup.formBuildGroup().id());
        myButton= dialogGroupControl.addControl(FormControlType::Button,'MyButton');
        myButton.text("@SYS91539");
    
        return dialog;
    }
    
    public void dialogPostRun(DialogRunbase dialog)
    {
        super(dialog);
    
        dialog.formRun().controlMethodOverload(true);
        dialog.formRun().controlMethodOverloadObject(this);
    }
    
    public void MyButton_clicked()
    {
    
    }


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans