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):

 

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:

9 Comments on “Microsoft CRM 2013: Adding standard Bing Map control to forms of custom entities

  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

Leave a Reply

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