Monday 20 June 2011

Silverlight Map in CRM 2011


There are many cases in which an organization will need to work with maps as part of their Dynamics CRM experience. For example, you might be part of a courier company that needs to be able to see your customer locations in a map before you can deliver the goods. It is now very easy to create a map which you can then embed inside Dynamics CRM 2011 through Silverlight web resources.
 How to Create a Silverlight Map Control for Dynamics CRM 2011
Firstly, I’ve created a new Silverlight project inside Visual Studio and have also downloaded the Bing Maps Silverlight Control SDK. The SDK includes the required libraries which you can reference to build your own controls using a Silverlight Bing Map.
Before you can actually start building and testing your mapping application, you will need to obtain an API key for the Bing Maps Silverlight Control. You will need to insert this key into your XAML code for the map to work correctly.
<UserControl x:Class="DisplayMap.MainPage"    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"    xmlns:m="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl"    mc:Ignorable="d"    d:DesignHeight="300" d:DesignWidth="400">
    <Grid x:Name="LayoutRoot" Background="White">        <m:Map x:Name="mymap" CredentialsProvider="<your key goes here"></m:Map>    </Grid></UserControl>
The next step is to add the map into CRM. To do this, locate the XAP file as part of the Visual Studio project. This is the file that we want to upload as our Silverlight Web Resource.
 How to Create a Silverlight Map Control for Dynamics CRM 2011
Open up CRM and navigate to Settings > Customizations> Customize the System. On the left navigation, click on Web Resources and then click on New to create a new Web Resource.
 How to Create a Silverlight Map Control for Dynamics CRM 2011
Give the new web resource a name and also select Silverlight as the type. Once this is done, save and publish your changes.
I am going to select the Account entity to hold our map control. Expand the Entities node in the customization area, select Account and then open up the main Account form.
I have created a new section on the Account form and have added the Silverlight web resource to it.
 How to Create a Silverlight Map Control for Dynamics CRM 2011
Now that it’s been added to the Account form, we just need to save and publish our changes once again. Now the map will be available for our users to view.

No comments:

Post a Comment