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
Pink TacoPink Taco 

Google map is not showing map in the accounts of salesforce.

Hi Guys,

     The code is done for the google map using visualforce page and assigned to the page layout. Not the all is showing any

     error. But even not showing the map in the following accounts. I don't know in which setting its not allowing me not to cross  

     the barrier to display it on accounts.

 

     Can anyone help me on this.

 

 

Regards

 

Cloud CredenceCloud Credence

Just a suggesion,

 

For google maps to work, the billing address of the account should be populated with a valid address.

 

See whether that is the reason.

 

Thanks

Pink TacoPink Taco

Here is the code. May be some permission is not allowing, I don't know which one.

But the code is fine. I think so.

 

<apex:page standardController="Account">

<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAbfPnDaL24nk10UVODur46RQ4hZBRKujLa20gdgk6BGq02b_7dRSUc-gU9S7Sru9i0Z4lD1pGbwanwg" type="text/javascript"></script>

<script type="text/javascript">

var map = null;
var geocoder = null;

var address = "{!Account.BillingStreet}, {!Account.BillingPostalCode} {!Account.BillingCity}, {!Account.BillingState}, {!Account.BillingCountry}";

function initialize() {
if(GBrowserIsCompatible())
{
map = new GMap2(document.getElementById("MyMap"));
map.addControl(new GMapTypeControl());
map.addControl(new GLargeMapControl3D());

geocoder = new GClientGeocoder();
geocoder.getLatLng(
address,
function(point) {
if (!point) {
document.getElementById("MyMap").innerHTML = address + " not found";
} else {
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.bindInfoWindowHtml("Account Name : <b><i> {!Account.Name} </i></b>
Address : "+address);
}
}
);
}
}
</script>


<div id="MyMap" style="width:100%;height:300px"></div>
<script>
initialize() ;
</script>

</apex:page>

 

 

 

MoUsmanMoUsman

Hi Pin Taco,

 

Please follow the link given below having a perfect example of google map for Account record in Salesforce!

http://sfdchack.blogspot.in/2012/09/google-map-integration-is-not-working.html

 

 

--

Thanks

Usman

Pink TacoPink Taco

No its not working..

 THe code I was using is not giving any error but still which permission is invoking that map not display.

 

Any other reason or idea.?

MoUsmanMoUsman

HI 

Are you giving Account id in your URl like https://salesforce prefix.com/apex/pagename?Id=AccountId ?

 

 

Thanks

Usman

Pink TacoPink Taco

I am just using this code in vf page and opening the account by adding the vf page in the page layout. 

The id comes like.. 

https://cs5.salesforce.com/001O000000BAnpw

 

Code:-

 

<apex:page tabStyle="Account" standardController="Account">
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAbfPnDaL24nk10UVODur46RQ4hZBRKujLa20gdgk6BGq02b_7dRSUc-gU9S7Sru9i0Z4lD1pGbwanwg" type="text/javascript"></script>
<script type="text/javascript">

function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());

var geocoder = new GClientGeocoder();

//var address = "{!Account.BillingStreet}" + ", " + "{!Account.BillingCity}" + ", " + "{!Account.BillingState}"+"{!Account.BillingPostalCode}" + "," + "{!Account.BillingCountry}";
var address = "{!Account.BillingStreet}" + ", " + "{!Account.BillingCity}" + ", " + "{!Account.BillingState}"+"{!Account.BillingPostalCode}" + ", " + "{!Account.BillingCity}" + "," + "{!Account.BillingCountry}";

var point = geocoder.getLatLng(
address,
function(p) {
if (!p) {
alert(address + " not found");
} else {
map.setCenter(p, 13);
var marker = new GMarker(p);
map.addOverlay(marker);
//marker.openInfoWindowHtml(address);
marker.openInfoWindowHtml("<font>{!Account.Name}<br>{!Account.BillingStreet} <br>{!Account.BillingCity} {!Account.BillingState} {!Account.BillingPostalCode} <br>{!Account.BillingCountry}</font>");
}
}
);


}
}

</script>

<div id="map" style="height: 300px"></div>

<script>
load();
</script>

</apex:page>

Pink TacoPink Taco

or can i share through teamviewer with you. could just check it up once. If you can.!!!

MoUsmanMoUsman

Hi ,

Please copy and paste the code given in the link http://sfdchack.blogspot.in/2012/09/google-map-integration-is-not-working.html , http is the Issue in your code you are using the link "http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAbfPnDaL24nk10UVODur46RQ4hZBRKujLa20gdgk6BGq02b_..." without having https i.e not supported by Salesforce. Please use https version of above script. And I have given you a perfect example just copy and pase it runs perfactly I am **bleep** sure.If in cae it is not working please let me know.

 

--

Thanks 

Usman

Pink TacoPink Taco

Used the mentiond code. But showing blank value in the accounts.

MoUsmanMoUsman

Please sand a complete page screen shot having url .

Pink TacoPink Taco

I am not able to paste it here.. could you giv me ur email I'll send it you....

MoUsmanMoUsman

mo.usman786@gmail.com, And please check you account record which id you are passing in Url having billing address for the record? 

empucempuc

Few months ago I had a same problem. After changing the link to the google script from http into secured https it helped. Could You please also try to add the site address into REMOTE SITE SETTINGS?

 

Have You tried to check this feature on different webbrowsers?

Pink TacoPink Taco
I had used the http by replacing with https. and also added the address in the remote site settings. I didn't worked in my case. Else in other browsers, its working perfectly fine without using this all.
empucempuc

So which browser is the only one which does not support it for you?

Pink TacoPink Taco
chrome.
MoUsmanMoUsman

Hi ,

 

Please have a look on a live demo and code  http://sfdchack.blogspot.in/2012/09/google-map-integration-is-not-working.html 

If you are still g\facing issue please let me know.

 

--

Thanks

Usman

gautam_singhgautam_singh

Hi ,

Follow These Steps

1. Create a visualforce Page with code from here  .

2. Make Sure that yu have added those Jquery Files asa Static Resource .

3. Add that Visualforce Page access in the Profile of the user with which you are logged in .



Important :


HIt Kudos If this is helpful and If this is the answer which you were looking for mark it as as a solution .


Thank You

Fahad Rahat 9Fahad Rahat 9
There is a native 'Custom Link' for Google Map is available that works on the Account's standard address fields, and on clicking, navigate to maps.google.com page and shows the cooridnates as per address of account in salesforce
Alekhya Mathukumilli 7Alekhya Mathukumilli 7
Hello All,

I am also facing a similar issue visualforce page is showing up but it is not navigaitng to goolge maps URL on click. Please help em with this.