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

Notifications

Announcements

No record found.

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 397
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,118 Super User 2025 Season 2 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
    397 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,447 Super User 2025 Season 2 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 490 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 241 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans