How to: Define and Modify Table Methods
Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
When you create a new table in the Application Object Tree (AOT), MorphX automatically creates several methods for it. By adding X++ code to these system-defined methods, you can modify the default behavior of the system. You can also define your own methods. The system- and the user-defined methods share the same scope in the table. This makes it easy to add new methods and use them from the system defined methods. Notice that you cannot modify the return type, parameter list, or parameter types for the system defined methods, but you can add parameters if you declare a default value for them. This differs from any additional methods you define. These can be modified in any way; you can modify the return type, the parameter list, and parameter types.
To manage changes to AOT objects, a version control system is available. For more information, see Version Control System.
Modify a System-defined Method for a Table
In the AOT, expand the Data Dictionary node, and then locate the table that you want to modify.
Expand the Methods node for the table, and then double-click the method that you want to modify.
Modify or add to the code as necessary.
Compile and then click Save.
Create a New Method
In the AOT, locate the table that you want to modify.
Right-click the Methods node for the table, and then click New Method on the shortcut menu.
Rename the new method.
Double-click the new method to open the code editor.
Add code to the method in the editor.
Compile and then click Save.
Table methods can access all the other available methods. Any method defined for a table shares the same scope.
See also
Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.