Home > CRM Deployement, CRM Development, CRM Integrations, MSCRM General > MSCRM and MapPoint Integration – A picture is worth a thousand words.

MSCRM and MapPoint Integration – A picture is worth a thousand words.


Microsoft Provides MapPoint Web Service to enrich application with mapping functionality. It allows you to integrate maps, driving directions, order tracking and proximity searches into a wide range of solutions.

For those of you who want to start using MapPoint for test and development purposes you can sign up for a free developer account here:

htt
ps://mappoint-css.partners.extranet.microsoft.com/MwsSignup/Eval.aspx

With a developer account, you get full access to the MapPoint Web Service APIs and staging environment, which you can use to build applications for trial, demonstration, and proof-of-concept purposes.

Overview

Overview

Microsoft Dynamics CRM Account entity already has longitude and latitude parameters for address. But mostly organizations don’t use those parameters. MapPoint web service provides FindAddress service to resolve addresses and returns longitude and latitude parameter as shown in the code snippet below. 


Find Address Longitude and Latitude FindServiceSoap FindService = new FindServiceSoap ();
FindService.Credentials = new NetworkCredential(“”, “”);
FindService.PreAuthenticate = true;
MyAddress mAddress = new MyAddress();

mAddress = (MyAddress)addresses[i];

FindAddressSpecification spec = new FindAddressSpecification();
spec.InputAddress = new Address();
spec.InputAddress.AddressLine = mAddress.Line1;
spec.InputAddress.CountryRegion = mAddress.Country;
spec.InputAddress.Subdivision = mAddress.StateProvince;
spec.InputAddress.PrimaryCity = mAddress.City;
spec.InputAddress.PostalCode = mAddress.Postalcode;
spec.DataSourceName = “MapPoint.NA”;
FindResults results = FindService.FindAddress(spec);

Populating Location and Pushpin Array 

Location and pushpins objects require longitude and latitude values for address. Following code is used to populate Location and Pushpin objects of MapPoint API. 


Location[] myLocation = new Location[addresses.Count];
myLocation[i] = new Location();
myLocation[i].LatLong = new LatLong();
myLocation[i].LatLong = results.Results[0].FoundLocation.LatLong;
Pushpin[] pushpins = new Pushpin [addresses.Count]; pushpins[i] = new Pushpin();
pushpins[i].PinID = “pin0”;
pushpins[i].IconName = “0”;
pushpins[i].Label = mAddress.Name;
pushpins[i].IconDataSource = “MapPoint.Icons”;
pushpins[i].LatLong = results.Results[0].FoundLocation.LatLong;
There is no simple way to provide hyperlink at Pushpins, although Pushpin label and icon can be set to custom settings. Getting image and automatic zoom based on the geography covered by the addresses

MapPoint Web Service provides Render Service API to automatic zoom based on the geography covered by addresses. Here is the code snippet to do this:

//Call MapPoint Render Web Service RenderServiceSoap RenderService = new RenderServiceSoap();
RenderService.Credentials = new NetworkCredential(“”, “”);
MapViewRepresentations mvRep = RenderService.GetBestMapView(myLocation,”MapPoint.NA”);
mviews[0] = new ViewByBoundingRectangle();
mviews[0] = mvRep.ByBoundingRectangle;
MapSpecification mspec = new MapSpecification();
mspec.Options = moptions;
mspec.Views = mviews;
mspec.Pushpins = pushpins;
mspec.DataSourceName = “MapPoint.NA”;

MapImage[] image = RenderService.GetMap(mspec);

So the final image can be displayed in some ASP.NET page to show in Microsoft Dynamics CRM. Please find below my integration of MapPoint web service with MSCRM. One can select Accounts to be plotted on MapPoint and click Show Accounts Map Button at Account Entity grid toolbar.  All selected accounts will be plotted on the MapPoint in a new web dialog with Invalid addresses at the bottom.  

Step 1 


 Here is the final Image generated in Web Dialog:
Step 2 For any comments or suggestion do let me know. Your suggestions and comments are valuable for me. Thanks!

Advertisements
  1. June 13, 2007 at 10:29 pm

    Awesome work Ayaz!
    I would love to do it with SharePoint too, hopefully the results are as fantastic as with CRM……..

    Rehman
    http://rehmangul.wordpress.com

  2. June 13, 2007 at 10:36 pm

    Hi Rehman,

    MapPoint is amazing Web Service. Any application can use this and enrich with Maping features. One just need to provide valid address information to web service. Rest of Simple API will work for you.

    Cheers!

    Ayaz

  3. June 17, 2007 at 6:38 am

    Hi Ayaz, I was looking to integrate a CRM application with a location based system, but also make it work with a wordpress blogging system. Kind of a crazy idea, but I did not think of connecting php world with Microsoft world. I read your post, and saw that you are highly respected from the MS team, and Satya Nadella was also recommended, he was an Advisor to my previous co. I am wondering, what it would take, or is it absolutely crazy to integrate a WordPress engine or at least have it talk with or pass info with a MS Crm? Also email me privately and see if our blogging platform at http://www.mytypes.com may sound interesting to you to help with.

  4. June 17, 2007 at 8:24 pm

    Hi Vipin,

    Microsoft provides Mappoint as a web service. They are plateform and language independent. Just call MapPoint API through PHP using SOAP messaging or whatever mechanism PHP engine use to access web services and utilize them. It is very much possible in PHP.

    Regards,

    Ayaz

  5. Serge
    November 7, 2007 at 3:40 pm

    Hello!

    Can you please send me the code to do this Map integration in CRM for multiple pushpins.
    I can’t find full example on your site.
    Thanks a lot!

    Serge

  6. Faisal Fiaz
    November 20, 2007 at 10:27 am

    Dear Ayaz,
    Is it possible to provide options for a solution that allows CRM users to email contact records with multiple email addresses and be able to select the relevant email address.
    Regards
    Faisal

  7. Mohammed Arif
    May 2, 2008 at 3:19 pm

    Hi Ayaz,
    I want to implement the mapPoint Integeration in MSCRM4.0.Could you plz help me by providing some clear sample code for it.

  8. adi
    August 6, 2008 at 1:49 pm

    I believe the best way of migrating data into Microsoft Dynamic CRM is by using SQL Integration Services (SSIS).
    You can use SSIS script component to write code using the CRM SDK.
    I made a tool that helps generates the DLL required to use from SSIS script component to write Microsoft SDK code. You can download this too for free from this location http://www.ssis4crm.com
    You will fined there interactions of doing a simple load.
    This way is supported by Microsoft (using MSCRM SDK)

  9. November 16, 2008 at 9:46 pm

    Excellent post Ayaz…

    I have been playing with the Yahoo! AJAX map API to deliver similar results:

    http://www.mscrmblog.com/blog/2008/11/16/yahoo-ajax-maps-for-dynamics-crm-part-2.html

  10. Rajas Gokhale
    March 2, 2009 at 10:31 pm

    Ayaz,
    this is fantastic stuff.

    Is it possible to enhance the charting functionality of MapPoint from Excel? I mean can one import following charts
    a. charts having two axes
    b. charts having negative values
    c. line chart
    d. stacked column chart (although this can be transformed into a pie chart which is supported by MapPoint)

    I am thrilled at the prospect of using MapPoint for some of our dashboards but it seems to be capable ofonly a few charts. I appreciate any help you could prvoide and thank you in advance.

    Best Regards,
    Rajas.

  11. RaiulBaztepo
    March 29, 2009 at 12:21 am

    Hello!
    Very Interesting post! Thank you for such interesting resource!
    PS: Sorry for my bad english, I’v just started to learn this language 😉
    See you!
    Your, Raiul Baztepo

  12. meenakshi
    March 14, 2013 at 5:10 am

    can u pls guide me how to use the code step by step process
    as im new to work on with soap

  1. February 14, 2008 at 8:27 am
  2. March 3, 2008 at 6:42 pm
  3. March 5, 2008 at 4:57 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: