How to: Update a Service After Adding a Table Field
In Microsoft Dynamics AX, if you add a field to a table which is exposed in a service, you must update the document service data objects so that they contain the new field. This topic covers the process you must follow to update the necessary classes.
If you add 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). For example, AxCustTable which can be found in the AOT under the Classes node. At the foundation level are the query data sources. These are tables such as the CustTable table.
Process for Updating Service Classes
After you add a field to a table that is a query data source on which a service is based, you must follow this process to make sure that your service and data object classes are up to date.
To Restore the Service Query
Navigate to the query on which the service is based in the AOT by expanding the Queries node and navigating to the Axd<Document> query. For example, the AxdCustomer query.
Right-click the query and select Restore. The query data source that uses the modified table now contains the added field.
Save your changes.
To 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 and the Update AxBC Classes fields.
Click OK. When you select Update AxBC Classes, the wizard regenerates the Ax<Table> classes for this service and adds set and parm methods to this class for the new field.
To Refresh the Service
- Navigate to Basic > Setup > Application Integration Framework > Services and click Refresh to refresh all of the services. You must refresh the service in order for the new field to appear in the endpoint action data policy.
After you complete these steps, the table, the query, the Ax<Table> classes, and the data object classes will be synchronized.
You can verify that the new field appears in the document schema and in the endpoint action data policies by following the steps in How to: View Document and Endpoint Schemas.