Disable/Enable New Button Using Extensions in new Microsoft Dynamics AX

November 4, 2016

The requirement is to add menu item button on Job card form that will be enabled if the production order has any quality orders, disabled otherwise. It should open the quality order related to production order.

These are the steps:

    1. Create form extension and add new menu item button

Make sure that you set the button property AutoDeclaration to Yes. This menu item will open the Quality orders form. The data source on the new menu item button should be set to ProdTable.

    1. Create new class called the same as the form followed by EventHandler
    2. This form has a method called setButtonAccess. It will be extended by creating new Pre-EventHandler method. Right click on the setButtonAcess, select Copy event handler method and Pre-event handler.

Go to the class and paste select event handler method.

    1. The requirement is that the button should be enabled if there is a quality order for the production order on the main form. This will be achieved by the following: