Hi Harshil,
I was also facing the same issue with the bing map in CRM 2013 version, i tried the work around solution by creating the web resource and added it to the form. Below is the code that you can use.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/.../xhtml1-transitional.dtd">
<html>
<head>
<title>My Bing Map</title>
<script type="text/jscript" src="WebResources/new_jquery"></script>
<script charset="UTF-8" type="text/javascript" src="ecn.dev.virtualearth.net/.../mapcontrol.ashx;s=1"></script>
<script src="ClientGlobalContext.js.aspx" type="text/javascript"></script>
<script type="text/jscript" src="WebResources/new_XrmserviceToolkit"></script>
<script type="text/javascript">
var map = null;
// get the bing map key msdn.microsoft.com/.../ff428642.aspx
var credentials = "your key";
var street="";
var city="";
var state="";
var zipcode="";
var country="";
function GetOwnerData(retrieveReq) {
if (retrieveReq.readyState == 4) {
if (retrieveReq.status == 200) {
var retrieved = JSON.parse(retrieveReq.responseText).d;
if(retrieved.results[0].address1_line1!="" && retrieved.results[0].address1_line1!='')
{
street = retrieved.results[0].address1_line1;
}
if(retrieved.results[0].address1_city!="" && retrieved.results[0].address1_city!='')
{
city = retrieved.results[0].address1_city;
}
if(retrieved.results[0].address1_stateorprovince!="" && retrieved.results[0].address1_stateorprovince!='')
{
state = retrieved.results[0].address1_stateorprovince;
}
if(retrieved.results[0].address1_postalcode!="" && retrieved.results[0].address1_postalcode!='')
{
zipcode = retrieved.results[0].address1_postalcode;
}
if(retrieved.results[0].address1_country!="" && retrieved.results[0].address1_country!='')
{
country = retrieved.results[0].address1_country;
}
}
}
}
function GetMap() {
var leadid = parent.Xrm.Page.data.entity.getId();
var serverUrl = Xrm.Page.context.getClientUrl();
var oDataSelect = serverUrl + "/XRMServices/2011/OrganizationData.svc/LeadSet?$select=address1_line1,address1_city,address1_stateorprovince,address1_postalcode,address1_country&$filter=LeadId eq guid'" + leadid + "'";
var retrieveReq = new XMLHttpRequest();
retrieveReq.open("GET", oDataSelect, false);
retrieveReq.setRequestHeader("Accept", "application/json");
retrieveReq.setRequestHeader("Content-Type", "application/json;charset=utf-8");
retrieveReq.onreadystatechange = function () {
GetOwnerData(this);
};
retrieveReq.send();
// countryName - name of the country from the CRM's form
var street1="";
var city=""
var state="";
var zip="";
var country="";
// calling virtual earth api
var geocodeRequest = "dev.virtualearth.net/.../Locations;+country+"&adminDistrict="+state+"&locality="+city+"&postalCode="+zipcode+"&addressLine="+street+"&key=Av8lTZaT8qD_GQh7DdXRvoCRqFm_OWD8IGeNacH7ufrpsFsH99RVQRfDwoF-tyC_+ &jsonp=GeocodeCallback";
CallRestService(geocodeRequest);
}
function GeocodeCallback(result) {
if (result && result.resourceSets && result.resourceSets.length > 0 && result.resourceSets[0].resources && result.resourceSets[0].resources.length > 0) {
var coordinates = result.resourceSets[0].resources[0].point.coordinates;
var centerPoint = new Microsoft.Maps.Location(coordinates[0], coordinates[1]);
map = new Microsoft.Maps.Map(document.getElementById("mapDiv"),
{
credentials: credentials,
center: centerPoint,
mapTypeId: Microsoft.Maps.MapTypeId.road,
zoom: 12
});
var pushpin = new Microsoft.Maps.Pushpin(map.getCenter());
map.entities.push(pushpin);
}
}
function CallRestService(request) {
var script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute("src", request);
document.body.appendChild(script);
}
</script>
</head>
<body onload="GetMap();">
<div id='mapDiv' style="position: relative; width: 600px; height: 300px;"></div>
</body>
</html>
If this answer helps you, please mark my answer verified.
Thanks,
Shahbaaz