Address DocType and Waze Section

So, as I have been implementing ERPNext, the first thing our young startup needed was to clarify Customers, Suppliers and their corresponding addresses. We had some basic excel forms, and I have succesfully imported everything into ERPNext.

One problem I run into frequently is the time spent clarifying an address’ location. Don’t get me wrong, myself and our staff orient ourselves excellently around our delivery and pickup locations, however there are several scenarios:

  1. Lead or Customer
    When discussing delivery locations with customers, my personal habit is to jot down the address, and if I am unclear about the location I will ask the person to give me the “informal details”: “We are 2 blocks away from ‘landmark place’, it’s a red wall with a black metal door”

As the customer speaks, I’m opening the waze or google map, and I “virtually navigate” to this location, providing feedback such as: “Ah yes, you are located in front of ‘landmark place’, the nearest cross street is ‘5 street’, right?” (dialog continues, but at this point I am placing a location on an online map, copying the permalink and pasting it in the contact notes.)
This ensures NO time and energy is wasted when customer is visited for the first time.

  1. Delegating
    This stems from the first issue. When visited for the first time, the customer is not ‘bothered further’ by us, he or she just gets our visit to deliver. But when an alternate person has to deliver, different than the usual driver, or the person who first jotted the address down, complex delivery instructions have to be issued to the alternate person. This takes a lot of precious time. Confusion arises, and sometimes I have not found the original address because the person who wrote it down did not commit every detail since the first time.

All of our businesses has some sort of logistics involved, and of all the mapping applications, the best for this job, by far: Waze

I have already added a custom section with a Waze map within an iframe to the address DocType, using an HTML field. This basically centers the location on the map, pulling coordinates from lat and lon defined in the iframe declaration. I am working to have tese coordinates parsed from fields assigned to each adddress, to be stored in the DocType table. The section would also create a read only URL with the waze:// URL to open Waze directly from the ERPNext Address display and enable navigation. This would be useful for the driver having the delivery assigned, or to attach wit a custom field to the delivery note. When the Dilivery Note is opened, the waze:// link is shown for the driver to navigate from there as well.

Some of the things I am still working on, and I am having trouble with are:
A. When first entering an address, clicking on a map location within the waze iframe and when the permalink link is displayed on screen, have ERPNext capture this data and parse it to drop the pure lat and lon coordinates in the lat and lon custom fields located in the same section. Given the cross domain policy restriction, I have not even been able to use JSONP (which I am still learning) but continue to work on being able to extract lat and lon. I will post code for this when I get to my computer for comments and ideas.

B. Waze Transport SDK
I applied to the transport SDK to evaluate whether this is a better solution to implement #A problem above, and also to create a Routing DocType that can help me route deliveries or pickups from within ERPNext. I understand that the Waze Transport SDK allows sending ETA to route stops, but have yet to see what you can do with it. Anybody here used it yet? Thoughts?

So I have resolved to use this in a rudimentary fashion.
I will include the lat and lon for each address as a custom field. So when lat and lon values are extracted by the database, use JavaScript in such a way that it will get the data from those fields as the page loads, and parse the iframe src to “set” the waze map center and a pin to the lat lon pairs stored in the database and pulled with each record. (I can pull values from each lat and lon field using getElementByID.value) How can I interface with a custom field named: waze_lat and waze_lon to get the values of those fields?

I have the development setup in an HTML page for now, hoping just to change to the variables in the Address DocType referring to the data in the fields I mentioned.

http://pastebin.com/2s4aPZ1H

1 Like