Export (0) Print
Expand All

Updating Data With AIF

Dynamics AX 2009

This topic describes the different ways that you can update data using Application Integration Framework (AIF). AIF services support updating data so companies can implement data synchronization with systems external to Microsoft Dynamics AX. Each document service that is included with Microsoft Dynamics AX that supports data updates has an update service operation. AIF supports two types of updates:

  • Full update - All the data submitted to AIF is considered to be the full document and all fields in the database tables will be updated with the fields from the submitted document. If there are fields in the table that are not in the submitted data, those table fields will be cleared according to the rules for the data type of the field.

    The result of a full update is the same as if you deleted the record and then added it from the submitted data with these exceptions:

    • Primary key fields are not changed.

    • Fields that are allowed by the schema but not included in the submitted data are cleared.

    • Fields that are not allowed by the schema and therefore cannot be sent as part of the update message are defaulted if they have defaulting logic but are not affected otherwise.

    For more information on full updates, see Walkthrough: Updating Data with AIF (Full Update).

  • Partial update - Only the fields contained in the submitted message will be updated in the database tables. If there are fields in the table that are not in the submitted data, those field values will retain their original values (except for fields that are defaulted based on other fields that have been updated).

The behavior of the partial update differs based on whether you are running Microsoft Dynamics AX 2009 SP1. For more information, see Update Action Rules in AIF.

When you update data through AIF, you call the document service update service operation. For example, if you want to update a sales order, you call the SalesSalesOrderService.update service operation. This operation takes two parameters.

  • _entityKeyList - An XML message that contains one or more entity key values (IDs) for the records to be updated.

  • _salesSalesOrder - An XML message that contains the sales order data that will update the sales order in the database.

Each of these parameters must be valid XML and validate against the document and endpoint schemas. These schemas define the content and structure of the service operation parameters.

There are various schemas that define what data can be updated as shown in the following table.

Schema

Description

Document schema

Defines all the fields that can participate in a data exchange. Any message that comes into AIF must validate against the document schema.

Endpoint schema

Further restricts the fields that can participate in a data exchange for a particular endpoint. The endpoint schema is defined by the data policy that you set for each endpoint action.

View the Document Schema

The document schema is the full schema and contains the complete structure and content for a message coming into AIF. The messages are passed as parameters to service operations. You can view the document schema for each parameter of the SalesSalesOrderService.update operation by following these steps.

  1. On the Setup pane in the Basic module, expand Application Integration Framework and click Services.

  2. Select the row for the SalesSalesOrderService service and click Service operations.

  3. Select the SalesSalesOrderService.update service operation and then click Parameter schema.

  4. Select the _salesSalesOrder parameter and click View schema. In the Schema form, you will see the complete schema for all the elements that can be in the message when you update a sales order.

  5. To save the schema as an .xsd file, click Save as.

    NoteNote

    You can also view the schema for the _entityKeyList parameter. This is the schema for the XML message that contains the entity keys (IDs) for the sales orders to be updated.


View the Endpoint Schema

The endpoint schema defines for each endpoint which fields can participate in an exchange. The endpoint schema is derived from the data policy for each endpoint action. The data policy specifies which fields are enabled and required for an endpoint action. To view the endpoint schema for the sales order update service operation, follow these steps.

  1. On the Setup pane in the Basic module, expand Application Integration Framework and click Endpoints.

  2. Select an endpoint and click Action policies.

  3. On the Endpoint action policies form, select the SalesSalesOrderService.update service operation and then click Parameter schema.

  4. Select the _salesSalesOrder parameter and then click View schema. In the Schema form, you will see the complete schema for all the elements that can be in the message when you update a sales order.

    NoteNote

    If you select the Default Endpoint on the Endpoints form and click Action policies, on the Endpoint action policies form, you will see a field that is named Is default policy. If this field is selected, then the endpoint is using the default data policy. This means that the schema for the endpoint is the same as the full document schema.


In order to specify an update, the XML message coming into AIF must contain the update action in the header as shown in the following code. This specifies that the sales order service update service operation should be called.

The update action is used for both full and partial updates. However, partial updates are signified by attributes.

<?xml version="1.0" encoding="utf-8" ?>
<Envelope xmlns="http://schemas.microsoft.com/dynamics/2008/
    01/documents/Message">
    <Header>
        <MessageId></MessageId>
        <SourceEndpointUser></SourceEndpointUser>
        <SourceEndpoint></SourceEndpoint>
        <DestinationEndpoint></DestinationEndpoint>
        <Action>http://schemas.microsoft.com/dynamics/2008/
            01/services/SalesOrderService/update</Action>
        <ConversationId></ConversationId>
    </Header>
    <Body>
…
    </Body>
</Envelope>

Community Additions

ADD
Show:
© 2014 Microsoft