Calculate Mileage in CRM 2011 using Google API in crm RRS feed

  • Question

  • Hi 

    I am following this blog to calculate distance between two zip code


    but I am getting an error like "Object doesn't support this action" at line "

    var service = new google.maps.DistanceMatrixService();

    I have copy paste the same line as in blog. can anybody can help me what I have missing here.

    Monday, May 5, 2014 2:40 PM

All replies

  • Hello Kartik35;

    I'm wondering if you have have the Google Map API Script File downloaded and uploaded into CRM. When referencing the javascript provided on one of the different events within an Entity even if it's on load or oneventchange please ensure the Google Map API Script File is referenced as a Form Library on the entities form. Pleasure ensure the Google Map API Script File library is ordered before the javascript file your currently calling the google.maps.DistanceMatrixService();.

    Please let me know if this resolves the issue; as it really sounds like the Google API javascript file isn't loaded before you try to reference it in memory.

    Jason Cosman

    Wednesday, May 14, 2014 7:20 PM
  • 1) I think Jason has good suggestion and You might need to check the particular jScript resource is loaded or not using the Chrome/IE Development tools(F12).

    2) Also one more thing is Make sure the resource is referenced/loaded correctly in the particular event of the form.

    3) One more thing is while coping and paste the code for JavaScript/HTML some time adds unsupported characters, so please paste the code into JavaScript beautifier online tool first and then click on "Beautify JavaScript or HTML" button and then copy the code from it and use that  in your CRM environment. I have came across those scenario before and this tool helps.


    let me know if that resolves your issue or not.

    Wednesday, May 14, 2014 7:52 PM