Microsoft Dynamics 365 Blog

silverLightlogo_main_sl The fact that I have moved my focus to other projects at Microsoft does not mean that I have forgotten about the CRM developers.  I am watching the CRM team very closely and to prove it here is some sample code that I want to share with you all. 

I have recently been prototyping some concept applications for Windows Live using managed code (C# being my favorite) in Silverlight V1.1 Alpha and thought it would be cool, if CRM developers could write their form logic in managed code instead of JavaScript(a.k.a. a painful language to code and debug – disclaimer: my opinion).  I am talking about client side JavaScript code that you all have to write for CRM form events (Onload/OnSave/OnChange).  Typically folks add logic to CRM forms to create richer and more interactive user experience, implement form verification/validation or mash up data from multiple sources in the browser without paying the cost of making a round trip to the server.

I spent a few hours to build a simple example just to show the concept.  The sample on its own doesn’t do anything fancy but enough to show “one way” of doing such a thing.  Here is why I think anybody would care about this sample compared to what is already enabled:


  • Developer experience: I personally have more fun writing in strongly typed and rich languages like C# than JavaScript.

  • Performance: Silverlight runs compiled C# code on the client. JavaScript is an interpreted language and hence generally slower in performance.

  • Protecting your investment: There are limited ways to protect JavaScript code since the code is viewable by the client, on the other hand, the prospects of protecting Silverlight managed assemblies is much higher (Obfuscation, MSLP, etc).

The sample code, instructions and Visual Studio project are all here:

http://blog.arash.cc/post/Adding-client-side-business-logic-to-CRM-forms-using-Silverlight-managed-code.aspx

Have fun coding…

Arash Ghanaie-Sichanie

We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!