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:
Everything is very open with a really clear explanation of the challenges.
It was really informative. Your site is extremely helpful.
Thanks for sharing!
How to generate GUID used for ClassId and CellId for mapcontrol control, shouldn’t it be unique according to the product(CRM)?
ClassId is something that should be copied from existing control (for example from Account or Contact form), CellId should be some unique identifier you can use this site for that purpose – https://www.guidgenerator.com/online-guid-generator.aspx
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
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.
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
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()
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
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
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?
Hello Thorsten,
I haven’t tried that approach since I wrote that post so I have nothing to share unfortunately.
What I have in my mind is development of PCF that will do what you need or use existing like this – https://pcf.gallery/google-maps-control/
Thanks,
Andrew
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?
Orianna,
I have no idea what it could be. What version of CRM do you use?
Andrew
Dynamics 365 online version. The customer service part, I am trying to add it to the cases.
Orianna,
I would recommend to use PCF controls instead of trying to use OOB control. You can download it here – https://github.com/AndrewButenko/ABControlsToolkit/releases/tag/1.0.0.3
Andrew
HI Andrew, How can I find the classID for the control so I can add
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
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
Hello Vijay,
Luckily in UCI you have an alternative option – PCF. I have a controls toolkit that contains map control you can place on any entity.
Check it out – https://github.com/AndrewButenko/ABControlsToolkit
Thanks,
Andrew
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
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
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.
Hello Milan,
What version of Dynamics are you on?
Andrew