+ Start a Discussion
Bhushan Mahajan 5Bhushan Mahajan 5 

I want to account object integrate with google map?.

 I am trying to integrate google map with account object , i have the following code but they are not working/ or not showing google map,
please tell me right code and improving code for google map.

<apex:page standardController="account">
<script type="text/javascript" src="https://maps.google.com/maps/api/js? sensor=false"></script>
<script type="text/javascript">
function initialize() { var map; var mapOptions = { zoom: 13, mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeControl: false } var mapMarker; var geocoder = new google.maps.Geocoder(); var address = "{!SUBSTITUTE(JSENCODE(Account.BillingStreet),'\r\n',' ')}, " + "{!Account.BillingCity}, " + "{!Account.BillingPostalCode}, " + " {!Account.BillingCountry}"; geocoder.geocode( {address: address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK && results.length) { if (status != google.maps.GeocoderStatus.ZERO_RESULTS) { map = new google.maps.Map(document.getElementById("map"), mapOptions); map.setCenter(results[0].geometry.location); mapMarker = new google.maps.Marker({ position: results[0].geometry.location, map: map, title: "{!Account.Name} " + address }); } } else document.getElementById("map").innerHTML = "Unable to find or display a map for {!Account.Name}'s billing address : " + address; }); } </script> <div id="map" style="width:100%;height:300px"></div> <script> initialize(); </script> </apex:page>
Andy BoettcherAndy Boettcher
If you want to wait a few days, this will be available natively through Salesforce.  http://releasenotes.docs.salesforce.com/en-us/spring15/release-notes/rn_forcecom_general_maps.htm