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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to addMenuItem in X++ and show button instead of link ?

(1) ShareShare
ReportReport
Posted on by 405
Hi guys,
 
When creating class (RunBase class), I'm adding a menuitem in my Dialog like this :
 
public Object dialog()
    {
        dialog = super();
         
        DialogGroup dialogGroup = dialog.addGroup('Upload file');
        FormBuildControl formBuildControl = dialog.formBuildDesign().control(dialogGroup.name());

        dialogJournalNameId = dialog.addField(ExtendedTypeStr(LedgerJournalNameId), /Ledger journal name/);        
        dialog.addMenuItemButton(MenuItemType::Action, /My_Template/);

        return dialog;
    }
 
 
After run, the addition menu item is displayed as a link. How to make it as a button instead ?
Thanks.
 
I have the same question (0)
  • Suggested answer
    Layan Jwei Profile Picture
    8,280 Super User 2026 Season 1 on at
    Hi Teevo,

    I would advise to use sysOperationFramework instead of runBase.

    Maybe check if this link is helpful:
    https://ariste.info/en/2020/07/add-menu-item-sysoperation-dialog/

    if you still want to stick with runBase, I think you should be able to do somehow the same to make it appear as a button.

    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future.
  • Teevo Profile Picture
    405 on at
    Hi Layan,
     
    Noted about your advice of using SysOperationFrameWork instead. 
    However may I know how should I still want to use RunBase ? 
     
    Issue is I'm not the original developer but assisting only hence I can't change the existing one and this is using RunBase. 
     
    Thanks.
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,811 Super User 2026 Season 1 on at
    Hi @Teevo,
     
    Try this :
    1 - Dialog method
    public Object dialog()
    {
        DialogRunbase           dialog;
        DialogGroup             dlgGroup;
        FormBuildGroupControl   buttonGroup;
        FormBuildButtonControl  buttonControl;
    
        dialog = super();
        dialog.caption("Dialog");
    
        dlgGroup        = dialog.addGroup('ButtonGroup');
        buttonGroup     = dialog.formBuildDesign().control(dlgGroup.formBuildGroup().id());
        buttonControl   = buttonGroup.addControl(FormControlType::Button, 'Button Name');
    
        buttonControl.registerOverrideMethod(methodStr(FormButtonControl, clicked),
                                             methodStr(YourClass, YourClickedMethod),
                                             this);
    
        return dialog;
    }
    2 - Clicked method
    private void YourClickedMethod(FormButtonControl _formButtonControl)
    {
        MenuFunction    menuFunction;
        menuFunction = new MenuFunction(menuitemActionStr(My_Template), MenuItemType::Action);
        menuFunction.run();
    }
    Best regards,
    Mohamed Amine MAHMOUDI

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 393 Super User 2026 Season 1

#2
Subra Profile Picture

Subra 385

#3
Martin Dráb Profile Picture

Martin Dráb 252 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans