Script# & Dynamics CRM 2011

UPDATE: I’ve gotten feedback from folks that I should remind everyone that there is now a Dynamics CRM 2011 Script# Xrm.Page library.

Script# (aka ScriptSharp) allows you to write C# code that compiles into JavaScript.  If you aren’t familiar with it, please watch this video first:

https://channel9.msdn.com/events/mix/mix11/HTM16

I’ve been a fan of Script# ever since it was announced.  However, in my previous role, there were a ton of higher priority technologies for me to cover.  I just never got around to Script# evangelism.  Well now that I am focusing on Dynamics CRM 2011, I have a reason to talk about it.  Script# isn’t for everyone, but those who spend enough time using it tend to swear by it.  In this video, I walk you through two core usage scenarios for Script# in the Dynamics CRM 2011 context:

  • Creating JavaScript web resources
  • Sharing basic logic across server-side code (plugins/workflow activities) & client-side code (JavaScript web resources)

Think of this as an alternative approach to producing JavaScript code for Dynamics CRM 2011.  I tend to like it for all the same reasons the Script# home page calls out: Intellisense that works!, MSBuild Support, Visualize your Code, Intuitive OOP Syntax, Unit Testing Support, Create Documentation, FxCop Code Analysis.  Yes, there are ways to do these things with JavaScript, but Script# lets you use what you already know if you are a C# developer.  If after watching this video, you decide it’s not for you, then erase it from your memory banks and continue with your current approach.

NOTE: Sorry about the audio quality (echo).

https://channel9.msdn.com/posts/Script–Dynamics-CRM-2011/player?w=512&h=288

@devkeydet

Dynamics CRM 2011 Administration Resources

NOTE: I will update this post periodically.

Although my focus is on Dynamics CRM 2011 as a development platform, I get asked about Administration resources all the time.  Basically, you need the fundamental admin skills required for the underlying technologies Dynamics CRM 2011 builds on: Windows Server, SQL Server (including Reporting Services), IIS, and understanding of how CRM Connects with Exchange and Active Director and then the CRM 2011 specifics.  Here are a set of resources I typically point people to:

Microsoft Dynamics CRM 2011 Implementation Guide

Microsoft Dynamics CRM 2011 Administrator’s Guide

Book Review: Microsoft Dynamics CRM 2011 Administration Bible

System Center Monitoring Pack for Microsoft Dynamics CRM 2011

Optimizing and Maintaining the Performance of a Microsoft Dynamics CRM 2011 Server Infrastructure

There’s also a Microsoft Learning online courses one might want to take:

Collection 80296: Installation and Deployment in Microsoft Dynamics CRM 2011

These resources should give you a sense for what it takes to be a CRM 2011 Admin. 

@devkeydet

Unit Testing with CRM 2011

I have a more involved blog post on this on the TODO list, but have promised a few folks some links to resources on how to unit test CRM/xRM code you write.  If you Bing (or that other search engine) “Unit Test” and “CRM 2011” you will come up with some good ideas that cover different .NET coding scenarios.  An approach I am a fan of is using Pex and Moles.  Until I have to to blog a walkthrough or screencast on it, those willing to do the mental translation can use the Unit Testing SharePoint Foundation with Pex and Moles whitepaper.  If you read it, you should be able to figure out how you would use the same approach with CRM code.  For JavaScript unit testing, take a look at QUnit which has fast become one of the more popular testing frameworks for JavaScript.

@devkeydet

My CRM 2011 Validation Framework

I’ve been working on a validation framework for Dynamics CRM 2011.  I’ve published the first cut of the code.  It’s a little rough still, but I’ve been promising the sample to a few customers so I wanted to get the first working version out there.  Right now, it only supports regular expression validation.  However, if you read the home page, you will see how you can get involved in shaping the future of the sample.

http://bit.ly/dkdtcrmval

Here’s a video walkthrough of the functionality.

https://channel9.msdn.com/posts/Dynamics-CRM-2011-Validation-Framework-Setup-and-Configuration-Walkthrough/player?w=512&h=288

I’ll also be recording a “getting the code to build” and code walkthrough video.  For now, if you want to try to get the code to build, ensuring you have NuGet installed and the Async CTP should do it.  However, I haven’t had time to test it on a clean machine so the “works on my machine” disclaimer applies. 

@devkeydet

Building an editable grid for CRM 2011

This is a common question lately.  First, I strongly recommend you consider purchasing an addon that does this for you.  Build vs. buy is always touchy because sometimes it is easier just to write it than to get approval to purchase an addon.  However, building an editable grid can be time consuming, depending on the complexity of your scenario and how reusable you want your code.  Furthermore, most people will go the “bang it out” vs. “build a robust reusable solution” approach which typically means repetitive coding the next time you want an editable grid somewhere else in your CRM UI.  We all know how that story goes…you were under the gun to get it built so you have copy/paste code everywhere.  In the end, it is probably more cost effective to buy an addon.  Here are the ones I know about:

http://pinpoint.microsoft.com/en-US/applications/add-edit-grid-for-crm-2011-and-crm-online-12884923430

http://pinpoint.microsoft.com/en-US/applications/editable-grid-add-on-for-crm-2011-and-crm-online-12884921672

http://www.c360.com/RecordEditor.aspx

http://www.axonom.com/crm_solutions/powertrak/articles/editablegrids.html

http://crmentropy.blogspot.com/2011/11/call-for-comments-crm-2011-grid-editor.html

If these options don’t work for you because you are forced to build instead of buy, then it starts off by understanding the CRM Web Services: 

Use Web Service Data in Web Resources (REST and SOAP Endpoint) (fundamentals and when to use what)

You will need to review both subsections as well:

Use the REST Endpoint for Web Resources

Use the SOAP Endpoint for Web Resources

You need to understand both. Depending on a number of factors, you may use more of one vs. the other but will usually use some combination of both. For the SOAP service, I find the Silverlight CRM SOAP Library very useful. 

From there, you need to decide if you are going to build your editable grid using Silverlight or HTML/JavaScript.  I know there’s all sorts of conjecture about the future of Silverlight, but I’m still of the opinion that Silverlight allows you to build richer web UIs faster than HTML/JavaScript.  If you have a “no plugin” philosophy, then use HTML/JavaScript.  If you believe Silverlight is your fastest route to building the UI customization and you can afford the dependency on a browser plugin…there’s a sensible argument to use it.   I’m not getting in an argument about which one to use.  You decideSmile.  Both of the subsections have examples for Silverlight and HTML/JavaScript.  Within the REST subsection there is a “Contact Editor” sample that brings together some of the core concepts explained in the SDK.  Finally, the following article explains some of the missing pieces around OptionSets, building metadata driven UI, etc. 

Using Option Set Options with the REST Endpoint – JScript (Microsoft Dynamics CRM 2011)

While the article above only covers the JavaScript scenario, the concepts can be applied to Silverlight as well.  I am not aware of a Silverlight version of the article. 

Once you have been through all of this, you have the fundamentals necessary to build an editable grid.

Note that I didn’t focus on the UI pieces.  That’s because there are a multitude of articles out there on building Grid UIs with Silverlight or HTML/JavaScript.  The “Contact Editor” has a very basic UI.  You will most likely want to jazz it up a bit.

UPDATE (12/31/2011): Some folks have asked me about how I would go about building the UI.  Using Silverlight for this seems like overkill so I’d choose to go the JavaScript route.  I’m a big fan of Knockout JS.  Have a look at the tutorials and examples.  There’s an Editable grid sample.  At the end of going through all the resources above, I’d probably combine my what I’ve learned into a Knockout JS based implementation.  I’ve added it to my TODO list of blog posts/samples.  Now I just have to find the time to build it.

@devkeydet

What does a custom CRM solution look like?

UPDATED with the Grants Manager solution accelerator…

There are many examples that I will be blogging about.  Here is one that uses both Dynamics CRM 2011 Online and Windows Azure or Dynamics CRM 2011 and Windows Server on-prem.

http://311center.codeplex.com/

Microsoft 311 Accelerator for Dynamics CRM 2011

Microsoft 311 Service Center accelerator is an integrated citizen services framework that helps to streamline the processes in a citizen service center. It provides a framework to service citizen requests, provide information, manage back office processing, and utilize resources efficiently. The 311 Service Center accelerator is built on the fully integrated Microsoft Dynamics CRM 2011 and Windows Azure platforms, providing both on-premises and online delivery models.

The second link in this post has a video overview of the accelerator.  You can download the solution, including source code from the CodePlex link.

Another one to look at is:

http://grantsmanager.codeplex.com/

Grants Manager is a solution accelerator designed to help
government organizations and educational institutions to quickly deploy a grant
management system and customize it to their needs. Each deployment will require
tailoring to the specific needs of the organization.

@devkeydet

My CRM Dev VM

NOTE: I will occasionally update this post.

I’ve had a number of conversations with customers recently about what I recommend they install on their CRM dev environement.  In general, I always recommend that individuals do work in an isolated environment to shield themselves from conflicting with work from other devs.  For CRM, this usually means running a single box install of Dynamics CRM 2011 in a VM.  You can either Build your own VM or download preconfigured VMs (you need to create a PartnerSource or CustomerSource account for the latter).  Note that the “build your own” link refers to a prerelease version of Dynamics CRM 2011.  However, I’ve run through the steps with the released version and it still works as described.  Whether you build your own VM or use a preconfigured one, the first thing you are going to want to do is get the latest updates from Windows/Microsoft Update.  I strongly encourage you to opt in for Microsoft Update so you get the latest updates for all the non-Windows Microsoft software as well (Office, SQL Server, Visual Studio, Dynamics CRM 2011, etc.).  The next thing you’ll want to install is the latest update rollups for CRM 2011.  As of this blog post, the latest is Update Rollup 5 for Microsoft Dynamics CRM 2011 (KB 2567454).  The CRM Installers do give you the option to check for these updates and apply them as part of the install.  However, as of writing this, UR5 is on http://bit.ly/vmRaar, but hasn’t made it to the Microsoft Update servers.  The next thing you’ll want to install is the latest Microsoft Dynamics CRM 2011 Software Development Kit (SDK).  The SDK team keeps improving the SDK, adding more samples, documentation, tools, and features.  Therefore, you’ll definitely want to keep an eye out on The Microsoft Dynamics CRM Team Blog for SDK release announcements.  The downside to this, of course, is that if you don’t keep up you loose out on the goodies.  As of this post, the latest version is 5.0.7.  There are a bunch of hidden gem tools in the SDK.  Most of the customers I have spoken with don’t know about them.  Although I will be blogging about many of these in detail in the future, I’ll reiterate what I said my last post.  After you’ve installed the SDK, go immediately to the [InstallDir]tools and [install]templates directories. There two folders in particular that are golden nuggets of dev productivity: templatesxrm.pagescriptprojecttemplate and toolsdevelopertoolkit. Both of these add enhancements in the form of VS templates and other helpers that you won’t want to miss.  I’ve done dev without these tools and with these tools.  In my opinion, you’ll see night/day productivity improvement for building/deploying/testing web resources (including Silverlight), plugins, activities, and workflows in your dev environment.  The CRM Explorer that gets added to Visual Studio has some nice productivity enhancements as well.  Be sure to read through the docs in each folder.  There are a number of other tools/SDKs I recommend people install.  Not all will be relevant to every situation, but they are good to have installed.  The first set can be installed using the Web Platform Installer:

My “crash course” in Dynamics CRM 2011 Development

NOTE: I will update this post periodically.

UPDATE: I also maintain a Developer Tips n Tricks deck here.  The deck is additive to the content in this post.

Here’s my recommended training plan to become a Dynamics CRM 2011 developer (it’s what I used).  The foundational technologies you will need to understand are:

  • Visual Studio 2010
  • .NET Framework 4.0
  • SOAP based Web Services
  • OData (aka WCF Data Services)
  • Windows Workflow Foundation
  • Silverlight (optional)
  • HTML
  • JavaScript
  • XML (many customizations requiring tweaking XML or using tools that tweak XML)
  • SQL Server Reporting Services

There are other technologies that many CRM development efforts include as part of the overall system solution.

  • Excel & PowerPivot for advanced Business Intelligence & Reporting
  • Claims-based Authentication and ADFS 2.0
  • ASP.NET
  • Windows Azure Platform
  • BizTalk Server
  • Team Foundation Server

The first set are almost always used.  When to use the second set is highly dependent on the needs of the overall solution architecture.  I’ll be blogging about some of these over time.  Why is TFS in the second set?  I wish I could say TFS is almost always used, but just like other forms of development, it would surprise you how many people aren’t using good ALM tools.  You should strive to make TFS part of the first groupSmile.  There are all sorts of resources around the web to learn fundamentals of most of these technologies.  I am not going to make this post about those.  If you are looking for a one stop shop to ramp up on the above, then you might want to take a look at Pluralsight On-Demand.  I get nothing out of endorsing them.  I’m just one of many satisfied subscribers.  I consider them top notch.  I recently asked them about CRM training through their contact form.  The response was that it is on their TODO list.  The more people that ask, the higher priority it will get.  I already had the fundamental knowledge above when I began my CRM dev journey.  What’s next is what I did to ramp up and dig in to Dynamics CRM 2011 specifics.

After you’ve installed the SDK, go immediately to the [InstallDir]tools and [install]templates directories.  There two folders in particular that are golden nuggets of dev productivity: templatesxrm.pagescriptprojecttemplate and toolsdevelopertoolkit.  Both of these add enhancements in the form of VS templates and other helpers that you won’t want to miss. 

There are some very useful / productive tools and accelerators on CodePlex as well: http://bit.ly/ofh2Zy.  You’ll also want to bookmark the Microsoft Dynamics CRM Developer Center on MSDN.

Stayed tuned for posts and videos diving deeper on many of these topics and more.

If you are looking for more traditional training options, there are some decent online (not instructor led) courses from Microsoft Learning, here’s a link that narrows things down to CRM 2011 training:

http://bit.ly/v2OFmC

If you want to broaden the search (instructor led, etc.), go to:

http://www.microsoft.com/learning/en/us/training/microsoft-dynamics.aspx

You’ll want to update the “Microsoft Products” textbox to “Dynamics CRM 2011” from “Dynamics,” then select the training format you are interested in. 

Once you become a Dynamics Partner and have access to PartnerSource, you also have access to training and details on how to get certified.

 

@devkeydet