You need to sign in to do that
Don't have an account?
Updated google maps lat lang on save button (execute javascript)
I would like to add a custom build google maps application in sales force. I need my accounts to have the google maps lat lang data stored in a field. The following javascript function returns that data. How can i embed this script and have it executed everytime an account is saved?
[code]
<script>
var geocoder;
function funReturnCoordFromAddress(address) {
if (geocoder) {
geocoder.geocode(
{'address': address}, function(results, status){
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
//alert(results[0].geometry.location)
document.getElementById("target").value = results[0].geometry.location
//return results[0].geometry.location
}else{
alert("Geocode was not successful for the following reason: " + status);
}
});
}
}
</script>
[/code]