Thursday, September 6, 2012

Zip Codes Upload in AX 2012

 

Hi there,

Today I would like to discuss how to load Zip Codes to 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!



4 comments:

  1. Hi,

    Which are the other countries you were talking about?
    Thanks in advance!

    ReplyDelete
  2. Hi!

    Thanks for reading my blog. The countries available are:

    1- US
    2- Netherlands
    3-Sweden
    4- Belgium.

    I hope this helps.

    ReplyDelete
  3. Hi, do we need to create all the US zipcode, state and county information in an excel file? If so, where can I find a list of all zip,state and county information?

    ReplyDelete
    Replies
    1. Hi,

      It is very simple...Google!

      Thanks!

      Delete

Thank you for your thoughts. Your comment will appear in my blog shortly after review.

Have a great day!