19th February 2009
I saw this video on Dynamics AX on channel9. They are talking about a new feature they’ve added to Dynamics AX that allows you to measure a company’s carbon footprint. I thought that in order to use this in NAV, it has to come by default with the product. For an ISV to build it and maintain it adds cost upgrades and future maintenance, and clients will not voluntarily purchase it, so that they can enter more data as they run their daily transactions. I thought of other ways that I could build some tool that would improve the efficiency of companies in NAV and lower their global carbon footprint. Most companies ship goods to customers, and if they can verify the address before sending the goods. They would not only save money, but would also lower the carbon footprint. There are many online web services that provide address verification. Most of these services cost money. I looked into UPS. UPS provides address verification, as stated on their website. So I created a new account with UPS, registered to get a developer ID, read the manuals on how to interface with the web service and wrote a simple codeunit. The result was not what I expected. Their address verification only returns the city, State, and zip code. So it only verifies at that level.
Here is the Code for interface to UPS.
Next I started to look for other option and USPS (united State Posted Service) also provided web service for address verification. I followed the same process. Registered with USPS and eceived my developer ID. Studied the web service interface and built my code and tested with the test server. It was giving me the correct information and I was happy that I have finally found a free solution. I applied for production server so that I would test it against actual data and received permission error. After couple of email back and forth and being on phone with USPS, I found out that they only provide the address verification if you are using “USPS SHIPPING SERVICES ONLY”. That’s a big requirement for companies out there that use other shipping systems. Also you cannot batch process multiple addresses. Address verificaton only should be done at order entry time. They did mention that they provide CD’s that you can use to verify your Address for 3800$ per year. Here is the code snippet on how to interface with USPS.
The story continues. I was disappointed again. I looked at google maps. But all the interface are built for web applications. Yesterday I stumbled across yahoo Geocode. What is Geocode? Goecode is latitude and longitude of a location on earth. Yahoo provides a web service that returns these two coordinates.
Well how does that help in address verification? Well the API request and address and returns the latitude and longitude. In addition if it doesn’t find the address it suggest addresses or simply states that it could not find it. It is a free service. You need to apply here https://developer.yahoo.com/wsregapp/ for the applicationID. You are limited to 5000 query per IP address per day.
I suggest applying and getting your ID. It’s quick and on the next page you will be provided with ID, which you can use in the following solution I’ve provided.
I’ve basically written this report that loops through customer records and verifies the address with yahoo web service.
You can use this report to evaluate your existing customer records. I suggest that once you are done with this, you should implement it at order entry level. So that as orders are entered the user can click on a button that will verify the address for new customers. After implementing this solution. I found out that google also provides Geocode webservice. I believe they have better address database than yahoo. I will leave it up to your to implement that. You can find out more about it here. http://code.google.com/apis/maps/documentation/geocoding/index.html
And here is the report 50200 that you can run on your database. Please get the Developer ID first from yahoo and change the following line.
The attached report is 50200.
Address verification Report