+ Start a Discussion
Zach Gavin DelacroixZach Gavin Delacroix 

Google Map Marker on Visualforce Template

Hello guys,

I need help on the Google Map Marker to be available in my Visualforce Email Template.
Basically, the code below works fine in a visualforce page and I want to do similar to a Visualforce Email Template.

<script src="https://maps.googleapis.com/maps/api/js?&sensor=false">

      function showMap(){
      var latlng = new google.maps.LatLng(15.477830, 120.589827);
      var myOptions = {
          zoom: 8,
          center : latlng,
      var myMap = new google.maps.Map(document.getElementById('theMap'),myOptions);
      var marker = new google.maps.Marker({position:latlng,map:myMap});
     window.onload = showMap;

  <div id="theMap" style="width:300px;height:300px"> </div>

When the code is applied in a Visualforce Email Template, it returns me an entirely blank page. I have it directly coded in the Visualforce Email template (rendering html) and tried using a custom component as well but no luck.

I'm able to place the Map using the link below (Directly in my Visualforce Template) but no Marker of course.
<img src="https://maps.googleapis.com/maps/api/staticmap?center={!RelatedTo.job__r.Address__c}&zoom=14&size=300x400&sensor=false" ></img>

can anyone help me on this. Thanks a lot in advance :)

Uvais KomathUvais Komath

I guess scripts can't run on an email template due to security reasons.