function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
skupke1.390278698224649E12skupke1.390278698224649E12 

Error: A problem with the OnClick JavaScript for this button or link was encountered: google.maps.Geocoder is not a constructor

Since the release of Winter 16 our Java OnClicks have ceased to work, anyone out there that can help me as its business critical I get this reinstated.

Users are experiencing the following errors:
A problem with the OnClick JavaScript for this button or link was encountered: google.maps.Geocoder is not a constructor
A problem witht the OnClick JavaScript for this button or link was encountered: Object doesn't support this action.

We tried the following unsucessfully:
Adding {!REQUIRESCRIPT("https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js")}
Adding {!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")} and {!REQUIRESCRIPT("/soap/ajax/15.0/apex.js")} at the top
Changing connection.js and apex.js for version 34
Loading script through JavaScript as suggested in above URL

Current Apex code in question:
{!REQUIRESCRIPT("/soap/ajax/26.0/connection.js")}
{!REQUIRESCRIPT("https://maps.googleapis.com/maps/api/js?v=3.10&sensor=false")}
{!REQUIRESCRIPT("/soap/ajax/26.0/apex.js")}
{!REQUIRESCRIPT("https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js")}



var acc = new sforce.SObject("Account");
acc.id = "{!Account.Id}";

var PCZ = "{!Account.ShippingPostalCode}";

if (PCZ == ""){

alert("Please add a valid Residential Address");

}
else
{
var address = "{!Account.ShippingStreet},{!Account.ShippingCity},{!Account.ShippingState},{!Account.ShippingPostalCode},{!Account.ShippingCountry}"
geocoder = new google.maps.Geocoder();

geocoder.geocode({ 'address': address }, function(results, status){
if (status == google.maps.GeocoderStatus.OK){
//var message = 'Latitude: ' + results[0].geometry.location.lat()+'Longitude: ' + results[0].geometry.location.lng();
//var Values = results[0].geometry.location_type.toString();
//alert(Values);
//var options = acc.Residential_Geocode_Location_Type__s.toString();
//alert(options);

acc.Residential_Geocode_Location_Type__c = results[0].geometry.location_type.toString();

acc.Residential_GeoLocation__Latitude__s = results[0].geometry.location.lat();
acc.Residential_GeoLocation__Longitude__s = results[0].geometry.location.lng();
result = sforce.connection.update([acc]);
//window.location.href = "/apex/AccountEditClothing?id={!Account.Id}";
}
window.location.href = "/apex/AccountEditClothing?id={!Account.Id}";
}
);
}
logontokartiklogontokartik
There is a lot of changes to the way REQUIRESCRIPT will work with Winter 16. The problem in your case is that the Google Maps is not loaded when you click the button. Take a look at some of the discussions around the same.

https://developer.salesforce.com/forums/?id=906F0000000BXc0IAG

http://salesforce.stackexchange.com/questions/92462/requirescript-change-in-winter-16-release