How to: Update a Service After Deleting a Table Field
In Microsoft Dynamics AX, if you delete a field in a table you must update any document service data objects that contain that field. This topic covers the process you must follow to update the necessary classes.
If you remove a table field, this change must ultimately be propagated to the data object classes. Data object classes provide an object interface for the service data and are passed as parameters in the service operations. For more information, see About Service Classes. At the top level are the data objects. For example, the CustCustomer_CustTable class which can be found in the AOT under the Classes node. In between the data object and the query data source is the Ax<Table> class (also called an AxBC class) such as AxCustTable which can be found in the AOT under the Classes node. At the foundation level, are the query data sources which are tables such as the CustTable table.
Process for Updating Service Classes
After you delete a field from a table that is a query data source on which a service is based, you must follow this process to ensure that your service and data object classes are up to date.
Delete the parm Method from the Ax<Table> Class
Navigate to the Ax<Table> class in the AOT by expanding the Classes node and navigating to the Ax<Table> class.
Right-click the parm method for the data source field that was deleted, and select Delete. Each data source field has a corresponding parm field in the Ax<Table> class. For example, if the CustTable.URL field was deleted, you must remove the parmURL method.
Save your changes.
Delete the set Method from the Ax<Table> Class
In the same Ax<Table> class, double-click the set method for the data source field that was deleted and it will open in the Code Editor. For example, if the CustTable.URL field was deleted, you must remove the setURL method.
In the Code Editor, delete the set method code.
Double-click the setTableFields method and remove the call to the set method. For example, remove the code this.setURL(); from the method.
Save your changes and verify that the class compiles before moving on to the next section.
Run the Update Document Service Wizard
Select Tools > Development tools > Application Integration Framework > Update document service.
Select the service class, for example, CustCustomerService.
Select the Regenerate data object classes field.
Click OK. This will regenerate the data object classes from the parm methods in the Ax<Table> class. Because you removed the parmURL method, this field will be removed from the data object class used by the service.
After you complete these steps, the table, the Ax<Table> class, and the data object classes will be synchronized.