Utilizing Bing Maps on a Microsoft Dynamics CRM 2011 Form

Utilizing Bing Maps on a Microsoft Dynamics CRM 2011 Form

Recently, I worked with a customer that specializes on Medical Real Estate Leasing. One of the things they wanted to track was the businesses that could be present at a competitor's property.

I decided on creating a solution that will allow our customer to exploit information located on the web to automatically find the information they are looking for.

I created a custom entity called "Property" and along with address and other basic fields, a new (collapsed) tab with an Iframe was added. This tab was named "Satellite View" and code was added on the background that would react when the tab was expanded.

Here is how the "Property" Entity form looks (Notice the Satellite View Tab collapsed at the bottom):


 

On the form Editor; I added the new_map library to the form and called the propertyOnLoad function when the Satellite View changes:


Here is the code included on the new_map library:

mapIframe = function() {

if (Xrm.Page.getAttribute("new_address1_street1").getValue() && Xrm.Page.getAttribute("new_address1_city").getValue() && Xrm.Page.getAttribute("new_address1_stateprovince").getValue()) {

var engine = "http://www.bing.com/maps/default.aspx?where1=";

var address = Xrm.Page.getAttribute("new_address1_street1").getValue().replace(/ /gi, "%20");

address += ",%20";

address += Xrm.Page.getAttribute("new_address1_city").getValue().replace(/ /gi, "%20");

address += ",%20";

address += Xrm.Page.getAttribute("new_address1_stateprovince").getValue().replace(/ /gi, "%20");

address += ",%20";

//for birds eye view

address += "&style=b";

Xrm.Page.getControl("IFRAME_map").setSrc(engine + address);

}

}

propertyOnLoad = function(){

mapIframe();

}

Here is the call made on the Satellite View handler:


 

Once this is in place; when you open a property and expand the Satellite View tab, you will see the property displayed on a Bird's eye Bing Map with a list of businesses located on that building:

 


This information can then be used to generate leads, find more information regarding competitors, get directions, etc.

This simple solution can be developed into an API, giving you a full application integration experience instead of just looking through an Iframe:

 


If you would like more information regarding this functionality, please contact us at:info@zero2ten.com


Microsoft Dynamics CRM Blog