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 :
Finance | Project Operations, Human Resources, ...
Answered

Getting an added Menu Item Button on an Extension to Work

(0) ShareShare
ReportReport
Posted on by 100

I've done an extension on a form. I've added a Menu Item Button. I can't add any methods in the extension, so I created a class for COC. Code snippet:

[ExtensionOf(formStr(InventItemPrice))]
final class InventItemPrice_Extension
{
private xFormRun element;

[FormControlEventHandler(formControlStr(InventItemPrice, BOMCostRoll), FormControlEventType::Clicked)]
public static void BOMCostRoll_OnClicked(FormControl sender, FormControlEventArgs e)
{
}

I copied the event handler for OnClicked and pasted it into the code, see above. When I right mouse click on OnClicked and select Find References, I get the above link. When I run the form and click on the Menu Item Button, I get No object specified on menu item. Why?

I very new to D365 X++, so please excuse my ignorance. I appreciate any help.

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    You don't need any code to run a menu item button.

    Your problem is (like the error message says) that you haven't specified any object on the menu item. You need to specify an object type (Form, Class, Report) and the object name that you want the menu item to run.

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

    If you just want to put some code into the Clicked event handler, you should use a regular button and not a menu item button.

    If you use a menu item button, you need to specify a menu item pointing to an object, such as a class or a form. Then you can put your code there. It's still possible to handle the Clicked event as well, though, if there is some extra logic that you want to execute in the calling form.

    What's the best approach depends on what exactly you're doing.

  • NoDozing2 Profile Picture
    100 on at

    Again, I'm very new to D365 X++. When I pull up the properties for the menu item button, I don't see an object type nor object name property. I realize if I could do something like below, in form code, I won't get the message:

       [Control("MenuFunctionButton")]

       class menuItemButtonName

       {

           void clicked()

           {

           }

       }

    However, I can't view the form code in an Extension.

  • Verified answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    As already mentioned, if you want to run a menu item with the button (which is the purpose of MenuItemButtons), you need to define Object in the propeties of your Menu item. Then drag this menu item to a button group on the form extension. It will work without any development on the form.

    Could you please tell us what you are trying to achieve?

  • NoDozing2 Profile Picture
    100 on at

    I got it now. I was adding the menu item button within the design pane in the form. Adding a, action menu item into the project gives me the properties you mentioned. I'm past the error. I'm wanting to open a form, get some user input, get the results, etc. I appreciate your patience.

  • Suggested answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    Nice to hear that it works now!

    One more hint - you should use Display menu item for opening forms, Action menu item to run classes and Output menu items to display reports. I think there's no technical obstacle in using the wrong menu item type, but it's intended to be used like this.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 616

#2
André Arnaud de Calavon Profile Picture

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

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 331 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans