Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

CRM 2013 Bing map is not showing address field

(0) ShareShare
ReportReport
Posted on by 292

Hello All,

CRM Version: 2013 Roll Up 2, On-Premises.

We have enabled Bing map on Lead entity from system settings. We have also added Bing Map Key for activating it. The Problem is when we select address 1 (Composite field) in Lead entity it not pointing to that address in Bing Map.

I have searched for the same in different places and found only one thing that from Bing Map property you need to select Address 1 or you can also change it with Address 2. I have verified and its configured with Address 1 field. But, still no luck.

Any help would be appreciated. Thanks in advance.

Regards,

Harshil Shah

*This post is locked for comments

  • Shahbaaz Ansari Profile Picture
    Shahbaaz Ansari 6,205 on at
    RE: CRM 2013 Bing map is not showing address field

    Thanks deniel, it worked for me.

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CRM 2013 Bing map is not showing address field

    Hi Harshil,

    Recently I faced the same issue and I found that it is because the Bing-Map v7 is replaced with v8. 

    To address the issue, I applied the 'Bing Maps AJAX Upgrade for Microsoft Dynamics CRM 2013 Service Pack 1' to the CRM server.

    As named, the patch is for the CRM 2013 SP 1, if you are planning to have SP1 soon, then you might consider having that patch as a proper solution for your issue.

    Cheers,

    Daniel

  • Verified answer
    Shahbaaz Ansari Profile Picture
    Shahbaaz Ansari 6,205 on at
    RE: CRM 2013 Bing map is not showing address field

    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&quot;>

    <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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,489 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans