Thursday, October 31, 2013

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

In CRM 2013 Microsoft released really great feature – OOB integration with BingMaps. Unfortunately list of entities that support BingMaps control is limited to Account, Contact, Lead, Quote, Order, Invoice, Competitor and System User.
I did small investigation how this control is organized and I can confirm that it is possible to add OOB Bing Maps control to forms of custom entities. But be careful -  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 of address (in my case I’ve created custom field slick_address).
2. Put it on the form:

3. Save and publish form and entity.
4. Create solution and add your custom entity inside.
5. Export and unzip solution.
6. Open customizations.xml file and find 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 Xml and pack it back to archive with solution.
9. Import Solution into CRM and publish changes.
10 Once you’ve done this - open your entity form, enter address into your address field and check that address is displayed in BingMaps control:

No comments:

Post a Comment