
I spent a fair amount of time looking for this only to finally work out the code for online CRM. This is the code for a we resource that will load Google Maps reading off the Latitude and Longitude.
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
</head>
<body style="word-wrap: break-word;">
<div id="map-canvas"></div>
<script>
var map;
function initialize() {
// Retrieve the values from Dynamics CRM
var add1Lat = window.parent.Xrm.Page.getAttribute("address1_latitude").getValue();
var add1Long = window.parent.Xrm.Page.getAttribute("address1_longitude").getValue();
var add1Name = window.parent.Xrm.Page.getAttribute("address1_name").getValue();
// Calculate the values and set options
var myLatlng = new google.maps.LatLng(add1Lat, add1Long);
var mapOptions = {
zoom: 15,
center: myLatlng
}
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: add1Name
});
}
// Load the map
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</body>
</html>
*This post is locked for comments
I have the same question (0)This is a slightly modified cut and paste job from various sources. The field names are standard so as long as your lat and long fields are populated this should work. Once you created the web resource insert it into your form and off you go.