Customization

Microsoft CRM 2013: Adding standard Bing Map control to forms of custom entities

In CRM 2013 Microsoft released a really great feature – OOB integration with BingMaps. Unfortunately, the list of entities that support BingMaps control is limited to Account, Contact, Lead, Quote, Order, Invoice, Competitor, and System User.
I did a little investigation into how this control is organized and I can confirm that it is possible to add OOB Bing Maps control to the forms of custom entities. But be careful – the  provided solution is 100% unsupported, but doesn’t require any knowledge of development, JavaScript, HTML, and so on.

1. Create field for your entity that will be used for storing addresses (in my case I’ve created custom field slick_address).
2. Put it on the form:

3. Save and publish the form and entity.
4. Create the solution and add your custom entity inside.
5. Export and unzip the solution.
6. Open customizations.xml file and find the attribute you’ve added:

7. Add following Xml after address field (put field name you use for address into AddressField node):

<row>
  <cell id="{7c550a71-c8f5-469b-a221-aa4563525b70}" showlabel="false" rowspan="8" colspan="1" auto="false">
    <labels>
      <label description="Bing Maps" languagecode="1033" />
    </labels>
    <control id="mapcontrol" classid="{62B0DF79-0464-470F-8AF7-4483CFEA0C7D}">
      <parameters>
        <AddressField>slick_address</AddressField>
      </parameters>
    </control>
  </cell>
</row>

 

After this, your Xml should look like following:

8. Save the Xml and pack it back to archive with the solution.
9. Import Solution into CRM and publish the changes.
10. Once you’ve done this – open your entity form, enter address into your address field and check that the address is displayed in BingMaps control:

23 Comments

  1. Everything is very open with a really clear explanation of the challenges.
    It was really informative. Your site is extremely helpful.

    Thanks for sharing!

  2. How to generate GUID used for ClassId and CellId for mapcontrol control, shouldn’t it be unique according to the product(CRM)?

  3. I have a question. How can I (via script more likely) refresh this control? I mean I have it in account but I load some scripts there before address is loaded and the Map doesn’t find the address by the time it searches for it, therefore I would need to force a refresh call on the map, how can I do such as thing?

    Thanks

    1. Rene, to be fair I have no idea is it possible. I would suggest to check methods available for BingMap control using one of JavaScript debugging tools.

      1. Thanks, In fact I didn’t find a way. As a workaround I created a different Web Resource containing other map and hide the original one, not nice but it worked

        1. Hi,
          I have a better idea, i think.
          You can try putting the map in a subrgid on the form and use a web resource to refresh the subgrid on click on a button (you can add a html WR for this) or page/field events.

          For more reference: The client API is
          Xrm.Page.getControl(arg).refresh()

  4. Hi, thanks for this topic.

    I have some doubts. OOB bing map works on composite address. If I put only address as parameter, maps will miss city, postal code, country… Can I add these fields also as parameters, or I should join all these fields into one?

    Thanks,

    Milan

    1. Milan,
      As a possible workaround you can create a field that will be populated with City, Country, Street concatenated. After that you can use that field as a source for BingMap control.
      Andrii

  5. Does this work on D365 with unified design? I implemented this, but I only see “error loading control” with detailed message: “Error while mapping state to props during ComponentDidMount for control: mapcontrol”.
    Do you have any ideas how to solve this problem?

  6. Hi Andrew,

    It’s showing me the following error:

    Error loading control,

    and when I click into it Error while mapping state to props during ComponentDidMount for control: mapcontrol.

    Do you have any idea of what it could be?

      1. Dynamics 365 online version. The customer service part, I am trying to add it to the cases.

    1. Hello,
      The easiest way to get classid is to create a solution with an account with the form where bingmaps component is available on the form, export, unpact, check the customizations.xml looking for the place where bingmaps control is located. That’s the place you can get the classid from.
      Andrew

  7. is anybody successful using this approach in in D365 UCI? I have tried to get class id of map control from Contact. But I am not successful

      1. Andrew ,

        I am trying to use the PCF Map control. Do you have any help information on how to configure inputs. I did not find find any help info. Can you please direct me to any link?

        Thanks
        Vijay Annem

        1. Vijay,
          I work on documentation now. It will be available in few weeks.
          If you need immediate responses you can open an issue on GitHub and I will reply ASAP.
          Thanks,
          Andrew

  8. Hello Vijay,
    I have trying but map not display.
    Only display Text like “Click here to view map” I have clicked then open new tab and show Map.
    How to resolved show map as same page.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.