I have a visualforce page where I could able to show all account in google map.

My requierment is when I clcik on single account marker, I would like to go to detail page of the account.

Here is the code snippet Where I got all markers in addressinstances.

for(var i = 0; i < addrInstances.length; i++)
                            var currLatLng = new google.maps.LatLng(addrInstances[i].Location__Latitude__s,addrInstances[i].Location__Longitude__s )
                            var marker = new google.maps.Marker({
                            position: currLatLng,
                            map: map,
                            title:addrInstances[i].Name+ '\n'  +addrInstances[i].BillingStreet + '\n'  +addrInstances[i].BillingCity + '\n'  +addrInstances[i].BillingState  
                        /* google.maps.event.addListener(marker, 'click', function() {

                               window.location ='https://na15.salesforce.com/addrInstances[i].id';
                            google.maps.event.addListener(marker, "click", function() 
                                window.location = '/' + addrInstances[i].id;

                    } */     

Just wondering What I am doing wrong. Please guide me so that I can click on marker to navigate to detail page

Thanks in advance

Please help in this regard.


  • 7
    Could you include what you have at the moment? Visualforce page and Extension perhaps?
    – pjcarly
    Jun 11, 2013 at 8:46

1 Answer 1


Just create a new click listener for the marker (assuming you know the account ID):

google.maps.event.addListener(marker, "click", function() {
    window.location = '/' + accountId;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.