Tuesday, February 2, 2010

FormButtonManager

In AX 2009 a new nice framework was introduced to simplify form buttons enabling\disabling. This framework is primarily used for list pages, however it can be used for regular forms too. Usage of this framework is quite simple. A new class should be created for a form which implements ButtonStateProvider interface. This class will contain methods which define buttons enable\disable rules. After that form buttons should be mapped to the rules using FormButtonManager class. That's pretty much it. The only thing left is to call FormButtonManager.refresh() method on selection changed event to get buttons enabled or disabled according to specified rules.
For more details you can look at SMAAgreementTableListPage and SMAAgreementTableButtonStateProvider class.

3 comments: