You need to sign in to do that
Don't have an account?
skupke1.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}";
}
);
}
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}";
}
);
}
https://developer.salesforce.com/forums/?id=906F0000000BXc0IAG
http://salesforce.stackexchange.com/questions/92462/requirescript-change-in-winter-16-release