Show bing maps with Pin in Dynamics 365 custom entities

The default map control of Dynamics CRM can not be shown by selection from the custom controls. So it is not possible using the form editor, to add the bing maps control to arbitrary entities.

Instead, you need to add a new single line of text field to the form where you want the maps control to show. I usually use the name, it is only used for attaching the custom control. Add the form to a new solution and export it as unmanaged.

Unzip it, open the customizations.xml and edit the formXML as described below:

Go to the section, find the cell that you created as maps control place holder and edit the control element like below:

<row>
    <cell id="{deadbeef-eef6-4b9c-9caf-d5fbdef8d83d}" labelid="{e47da1dc-aa39-467d-b701-a7f055c50afc}" showlabel="false" locklevel="0">
    <labels>
      <label description="Name" languagecode="1033" />
      <label description="Nom" languagecode="1036" />
      <label description="Name" languagecode="1031" />
      <label description="Имя" languagecode="1049" />
      <label description="Nombre" languagecode="3082" />
      <label description="名前" languagecode="1041" />
    </labels>
    <control id="msdyn_name" classid="{F9A8A302-114E-466A-B582-6771B2AE0D92}" datafieldname="msdyn_name" disabled="false" uniqueid="{deadbeef-1701-54d2-09be-35295876ca8a}" />
  </cell>
</row>

Merge this with your current controlDescriptions element, where forControl has to match the uniqueId of the control. I changed the first section of the ID to “deadbeef” which is valid and easily findable.

All parameters below which contain “msdyn_name” have to match the name of the control that you used in the snippet above for adding it to the form.

<controlDescriptions>
    <controlDescription forControl="{deadbeef-1701-54d2-09be-35295876ca8a}">
        <customControl id="{4273EDBD-AC1D-40d3-9FB2-095C621B552D}">
            <parameters>
                <datafieldname>msdyn_name</datafieldname>
            </parameters>
        </customControl>
        <customControl formFactor="0" name="MscrmControls.Map.MapControl">
            <parameters>
                <value>msdyn_name</value>
                <mapSourceSwitch isGroup="true" static="true">CoordinatesGroup</mapSourceSwitch>
                <latitude>msdyn_latitude</latitude>
                <longitude>msdyn_longitude</longitude>
                <addressEditableSwitch isGroup="true" static="true">isAddressEditableYesGroup</addressEditableSwitch>
                <outputLatitude>msdyn_latitude</outputLatitude>
                <outputLongitude>msdyn_longitude</outputLongitude>
            </parameters>
        </customControl>
        <customControl formFactor="1" name="MscrmControls.Map.MapControl">
            <parameters>
                <value>msdyn_name</value>
                <mapSourceSwitch isGroup="true" static="true">CoordinatesGroup</mapSourceSwitch>
                <latitude>msdyn_latitude</latitude>
                <longitude>msdyn_longitude</longitude>
                <addressEditableSwitch isGroup="true" static="true">isAddressEditableYesGroup</addressEditableSwitch>
                <outputLatitude>msdyn_latitude</outputLatitude>
                <outputLongitude>msdyn_longitude</outputLongitude>
            </parameters>
        </customControl>
        <customControl formFactor="2" name="MscrmControls.Map.MapControl">
            <parameters>
                <value>msdyn_name</value>
                <mapSourceSwitch isGroup="true" static="true">CoordinatesGroup</mapSourceSwitch>
                <latitude>msdyn_latitude</latitude>
                <longitude>msdyn_longitude</longitude>
                <addressEditableSwitch isGroup="true" static="true">isAddressEditableYesGroup</addressEditableSwitch>
                <outputLatitude>msdyn_latitude</outputLatitude>
                <outputLongitude>msdyn_longitude</outputLongitude>
            </parameters>
        </customControl>
    </controlDescription>
</controlDescriptions>

Save the file and create a zip out of the solution files for importing it to CRM.

After importing, you’ll have the maps control integrated on the form:

Leave a Reply

Your email address will not be published.

RELATED POST

Link to Dynamics 365 records in UCI

Scope With the UCI getting used more and more, some have already noticed that the record links that can be…

HTML E-Mails with place holders in Dynamics 365

Scope E-Mails in CRM are very simple by default. But what if we want to have styles in them by…

Advanced Dynamics CRM E-Mail Templating

Scope Often customers have extended requirements for their mailing purposes. Not only do they often need a lot of information…

Generating salutations for CRM contacts

Scope In this blog post I'm going to show you how to easily generate salutations for contacts inside your Dynamics365…