Getting started with Microsoft MapPoint and Microsoft CRM 3.0…Continued

Pour Some Sugar On Me...

It's taken a while, but I have finally got round to finishing my MapPoint integration code for CRM 3.0. There's a whole bunch of things you can do with Microsoft MapPoint, but the most obvious is to display a location map based upon the address fields of an Account or Contact record.

I took the easy options of using an IFRAME and building a fairly straightforward ASP.NET page to handle the heavy lifting. I chose to display the map automatically, rather than having to click a button on a form, and the result is shown below.

CRM 3.0 & MapPoint

In order to use the solutions you need to sign up for a MapPoint developer's account as detailed in my earlier post here, then you need to get the Visual Studio 2003 project files which I have uploaded as a .ZIP file here.

  1. Customise the Account entity, and edit the main application form. Add a new tab called "MapPoint" to the form, then add a new section to the tab called "Map". In order for the map to use up all the available space on the form, I chose to hide the "Map" section.
  2. Create an IFRAME in the new section and set the name to "IFRAME_MapPoint". Set the URL to "about:blank" which will ensure that in the event of any unexpected errors, the map will just display a blank page.

    CRM 3.0 & MapPoint

  3. To ensure that the map displays correctly, change the following parameters in the IFRAME Formatting tab:

    CRM 3.0 & MapPoint

  4. Next, edit the form "OnLoad" event and copy the contents of the Account_OnLoad.js file that is included as part of the Visual Studio 2003 project. This script passes the address fields (Address Line 1, Address Line 2 etc) from the form to the MapPoint.aspx web page. Because there is no address information when you first create an Account, I've included some logic to prevent the MapPoint.aspx from being called unnecessarily.

    CRM 3.0 & MapPoint

  5. Don't forget to edit the URL in the OnLoad event to point to your own CRM Server, e.g http://crmserver:5555
  6. Now you need to set up the web site to host the MapPoint.aspx page. I chose to create a new sub-folder called MapPoint in my CRM Web Server <System Drive>:\Inetpub\wwwroot\MapPoint - Note: The CRM web site folder location may vary based on your original CRM installation options.
  7. Using IIS Manager, right click the MapPoint folder in the CRM web site, select properties, and click the "Create" button to convert the folder into a Web Application. This is important as we are using our own web.config file to store various application parameters.

    CRM 3.0 & MapPoint

  8. Finally, edit the web.config file that is included as part of the Visual Studio 2003 project. and change the following application parameters to your own MapPoint web service User Name and Password:

    <add key="MapPointUserName" value="UserName" />
    <add key="MapPointPassword" value="Password" />

    You'll see some other parameters here which control the size of the map displayed as well as the scale of the map. You can change these to meet your specific needs.

  9. Repeat this process for other entities that have address fields, such as Contacts and Leads.

That's all there is to it. Once you have published the customisations, this should work a treat. I will cover the actual code at a later date, but I have tried to perform a sensible amount of error checking so that any failures are handled gracefully.

This posting is provided "AS IS" with no warranties, and confers no rights.

Comments (10)

  1. I promised it a while ago, but it is finally here.&amp;nbsp; Jedi Master Simon Hutson has finally documented…

  2. Andrew Wolfe says:

    Thanks for this article… setting up the developer sign in and the web service password is actually harder than installing and running the sample app.  Great work.

  3. derekmartin says:

    I love this – it is just what we are looking for, however, I am curious, is it possible to modify this example to send Lat and Longs instead of the address information found in the contact record?  We have added these as new_lat and new_long to our records and this would be most helpful!

  4. Davel99 says:

    I’ve been trying to get this to work for 4 days but with no luck.. Via CRM I get the ‘Network Problem’ error. If I copy the full URL into explorer i get ‘Incomplete Address’. I’ve checked the code and the address does not appear to fall foul of this, indeed the only line with no data on is address line 2.

    Other than that great code …

    Any ideas guys?

  5. jb23 says:

    I am getting the same message via CRM "Network Problem"  I changed the MapPoint user name, and not get the "Web Service Problem" Message.  Any ideas?

  6. jlevymp says:

    Here’s the error I’m receiving…any assistance would be greatly appreciated!!

    Parser Error Message: Could not load type ‘AdventureWorks.CRM.MapPoint.GetMap’.

    Line 1:  <%@ Page Language="vb" AutoEventWireup="false" Codebehind="GetMap.aspx.vb" Inherits="AdventureWorks.CRM.MapPoint.GetMap"%>

    Line 2:  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    Line 3:  <HTML>

    Source File: c:inetpubwwwrootMapPointgetmap.aspx    Line: 1

  7. Simon Hutson says:

    Did you make sure your web site is configured to use the correct .NET Framework version?

  8. jlevymp says:

    which version is appropriate?  Currently 1.1.4322 is selected. Should this be changed to 2.0.50727?  Will that affect anything else?  The CRM implementation guide references 1.1 as being required for the Outlook client, but nothing about the server.  Thanks for your help!

  9. jlevymp says:

    I got it to work…my bin directory was missing.  Now I just need to figure out how to add the additional map function (pin tooltip, zoom and satellite views – similar to visual earth capabilities).  This is excellent!

  10. Simon Hutson says:

    Great stuff. You should take a look here as the starting point for building MapPoint Web Service apps or Virtual Earth Map Control apps.

Skip to main content