Microsoft Dynamics AX Support

This blog contains posts by the Microsoft Dynamics AX Support Teams Worldwide

Updating a customer address with AIF file based adapter

Recently we had an issue where we needed to update a customer with an xml file using the file base adapter.  Specifically, we needed to update DirPartyContactInfoView and DirPartyPostalAddressView for an existing customer.

As mentioned in, if the entity you are calling is not a date effective entity, then this isn’t too diffcult.

However, because DirPartyContactInfoView and DirPartyPostalAddressView have ValidTimeStateEnabled=Yes (as well as ValidTo and ValidFrom fields), not only did we need to use action=”update”, we also had to set updateMode=”CreateNewTimePeriod” and also include the ValidFrom/ValidTo dates like this:

       <DirPartyContactInfoView updateMode=”CreateNewTimePeriod” action=”update” class=”entity”>
          <CountryRegionCode xsi:nil=”true”></CountryRegionCode>
          <LocationName>primary phone</LocationName>
          <LocatorExtension xsi:nil=”true”></LocatorExtension>

Attached is the entire xml for the update.  Once you swap out the _DocumentHash and id’s (RecId, RecVersion, LocationId, etc.) for valid versions in your system, this should work against the Contoso sample data with Customer Account 10001.  You’ll also have to first create an Address and Contact Information entry for this customer so we’ll have something to update.


Btw, the appropriate xml for most updates can be generated by using the C# code in the blog post “Calling the Update Operation on Services in AX 2012” (link above), which is easier to debug and get working when compared to handcrafted xml. 

Once you have that working, perform the update then go into System Administration/Periodic/Services and Application Integration Framework. 

Click on History and find the update in the message list.  Click Document Logs and then View XML to see the actual XML used for the update.