Today I would like to discuss importing Zip Codes into Dynamics AX 2012 from a Text file and also point out what happens in the background.
In AX 2012, this task is fairly simple as there is an abstract class (AdressZipCodeImport) that takes care of this function. In addition to the abstract class, there is another class (AdressZipCodeImport_US) for each specific country that overwrites the ReadFile() method in the AddressZipCodeImport abstract class. In AX 2012, there only 4 countries available for Zip Code upload.
AddressZipCodeImport Class:
AddressZipCodeImport_US Class:
The AdressZipCodeImport_US class ReadFile() method contains a while loop that will allocate the data from the file being read into the LogisticsAddress variables. To accomplish this, you will have to have your zip code, city, state and county name in an Excel file where you create the required spaces between fields and then save it as space delimiter file.
ReadFile() Method:
The following is an example of this sequence:
The following is the ReadFile() sub string coordinates:
When your file is ready, you can upload it by going to Organization Administration > Setup > Addresses > Import Zip/Postal codes:
Once you run this, the data will be in the LogisticsAddressZipCode table. It is very interesting to see how the AX 2012 team has put a lot of thought into these common tasks as they help us be more efficient on something we don’t need to really spend a lot of time figuring out. Until the next time!