Posts

Showing posts with the label NeedsRecord

New feature in Dynamics AX 2012 - NeedsRecord property on Buttons.

Image
In Dynamics AX 4.0 and 2009, if a button's action depended on a record being present, we usually added code in the executeQuery() method of the datasource to check for the existence of a record. If a record was not found, the button was disabled. Scenarios like these required specific code to be written by the developers. With Dynamics AX 2012, this has change. There is a new property NeedsRecord introduced on all button controls, these include your plain buttons, menu item buttons and command buttons as well. Menu button groups do not have this property. The NeedsRecord property works in conjunction with the DataSource property. Now we know that the normal buttons and command buttons do not have a DataSource property? So what happens in that case? The answer is the DataSource property is inherited from the parent of the button. This could be a button group or a tab page. If the button group also doesn't have the DataSource property set, then the kernel looks for the next pa...