As many of you may be aware, there is a lot of buzz around Microsoft Silverlight. For those that are unfamiliar with it I invite you to check its web site and play with it, it is really powerful. http://www.microsoft.com/silverlight/.
The potential of Silverlight goes beyond simple animations. The object model under the covers allows you to wire Silverlight with pretty much any application, especially one that is designed from ground up to be extensible, such as Microsoft Dynamics CRM J
I developed the application provided as part of this post to be presented at TechEd a couple of weeks ago by Michael Lu, a colleague Program Manager (actually my office mate). Based on the feedback received I decided to go ahead and post the source and explain it a bit. The demo illustrates how CRM customizers can wire up CRM with Silverlight.
What the demo does
It displays the pictures of an Author along with his/her related books in a nice little animation. You can drag and drop the pictures to the right to get more detail about the object being dragged. The information, as explained below, is pulled from CRM records.
Please note that the purpose of the demo is not to provide production quality code but to spark curiosity around the numerous scenarios that can be enabled by providing rich visualization capabilities within CRM using Silverlight. Download it, play with it and I’m sure you will almost immediately start thinking about tons of scenarios that you can achieve using both technologies. J
The components of the demo application are as follow:
Graphics
Silverlight is based on Windows Presentation Foundation (WPF) which means that graphics and animations of the demo are defined in the Extensible Application Markup Language (XAML); you can use a WPF editor such as Microsoft Expression Blend 2 to change it; the latest Blend preview supports Silverlight 1.0 and 1.1 Applications
Logic
I used Silverlight 1.0 which means that I didn’t dig into managed code (Silverlight 1.1 also supports managed code). All the logic is written in JavaScript using the provided Silverlight object model as well as event handlers. I might update the demo to use managed code in the future.
Dynamics CRM integration
Those who have experience working with CRM know that there are many extension points where third party applications can plug-in. All the techniques described in this post (Forms and FetchXml) that deal with CRM are documented in the CRM SDK.
The control that hosts the SilverLight Application is an IFrame inside a CRM Form of a Custom Entity. Since the logic is written in JavaScript I used two approaches to pull data from CRM:
· The first one was to pull data directly available on the Form using the CRM Form object model (crmForm).
· The second approach was to use XMLHttpRequest (AJAX although I didn’t used asynchronous calls) along with CRM FetchXML to interact with CRM webservices.
The SilverlightDemo.zip file contains all the necessary files to install the demo including the customization files for the entities used. The readme.txt contains detailed instructions on how to install the demo app.
I would love to hear if any of our readers has good examples of CRM-Silverlight integration J
Cheers!