Dynamics CRM 2011: Finally...Enterprise ALM for Dynamics CRM 2011

Originally published at http://goo.gl/XXm6z5 ​I wanted to bring your attention to two items that can be very useful for all of us working on Dynamics CRM. As you are aware, CRM customization and development has never really worked well with enterprise focused application lifecycle management (ALM.) The export capability (even with Solutions in 2011) has never worked very well with source code control and change management. In addition, scripting of builds and deployments for customizations have never been what I would call straight-forward or even possible. In the SDK released for Rollup 10 a Solution Packager command-line application that takes an exported solution file and breaks it up into its individual pieces. This combined with the command-line Solution Export tool in the MSCRM Toolkit provides the pieces necessary to automate CRM solutions in a system such as TFS or Git. (http://intovsts.net/2012/12/28/integration-of-dynamics-crm-2011-solutions-with-tfs/) Of course, the next request in enterprise development is automated deployment. As a holiday gift to the CRM world ADXStudio released a beta of their ADXStudio ALM Toolkit (http://community.adxstudio.com/products/adxstudio-alm-toolkit/) - licensing and pricing have not been announced so we’ll have to wait and see. This toolkit includes PowerShell Scriplets that allow for creating organizations and user and automated deployments of solutions, it includes a number of PowerShell scripts to demonstrate usage. It also includes a very valuable command-line tool to copy data from a source system to a file and then import the data during a deployment – this is especially useful for simplifying the process of loading configuration/base data during deployment. Taken together these tools provide the pieces necessary to fully automate the build and deployment process for Dynamics CRM. Many environments do not need this level of automation and the overhead for these tools has to be justified by the requirements. That said, for those environments where the needs justify the time/expense of full ALM it is good to know the requirements can be met with using pre-built tools.

December 28, 2012 · 2 min · Nicolas Nowinski

Dynamics CRM 2011: Simplifying the Request Response Model

Originally published at http://goo.gl/C1n3Hw If you have worked with the Dynamics CRM 2011 SDK you are probably very familiar with the Request/Response model messages in Microsoft.Crm.Sdk.Messages. As a developer trying to write good code I always want to wrap any service call in a Try/Catch statement to provide proper error handling. Another goal is to keep the code as neat as possible for when I – or someone else – has to go back and read it. Wrapping calls in Try/Catch statements increases the total lines of code it takes to implement functionality and makes the code more difficult to read. Recently I was working on a project where I had several of these calls in a row: Execute a request, process the response, build a new request, execute, etc. etc. While I was looking at the code I realized that my catch routine was basically the same (format a message for the user and exit out of the program – in addition to sending a number of execution details to the tracing service). Since the code was getting very long, my first thought was to refactor each of these calls into its own method. While this approach would make my code a bit cleaner, it was still somewhat limited in value. After thinking about the problem a bit more, I decided this would be a perfect opportunity to implement generics, extension methods, and delegates. If you are unfamiliar with any of these topics, here is a super quick introduction: - Generics allow us to create a method without having to know all the input types or the response type thus allowing the developer to specify them when calling the method. Extension methods allow us to create static methods against an existing class without having to inherit to a new class thus we do not disturb any code already relying on the class we want to extend. Delegates let us take a method (that matches the specified signature) and pass it as a variable. You can find out more about each of these concepts in the MSDN documentation links provided. Before we get too far into the details we should review the issue we are trying to resolve. Here is a very basic CRM plug-in that executes a WhoAmI request and gets a WhoAmI response. As I count it there are 6 statements with the try/catch but not including the PluginSetup (see my previous post athttp://goo.gl/lEaa9), to complete the request. It may not seem like a lot, but in the real-world those calls also have logging and the request probably has actual properties that need to be set. No matter what request message you use the basic pattern will remain the same. public void Execute(IServiceProvider serviceProvider) { var p = new PluginSetup(serviceProvider); var req = new WhoAmIRequest(); WhoAmIResponse response = (WhoAmIResponse)p.Service.Execute(req); ...

September 22, 2012 · 9 min · Nicolas Nowinski

Dynamics CRM 2011: Abstracting Plugin Setup

Originally published at http://bit.ly/RIxgt9 How people do it today… Often times when looking at Dynamics CRM plugin code that someone else has written – or that I have written in the past, I’m presented with a large collection of setup and validation code at the start of the Execute method. Overtime it becomes obvious that this is simply cluttering up our core Plugin code with what is really overhead infrastructure work. ...

August 11, 2012 · 5 min · Nicolas Nowinski

Dynamics CRM 2011: Check Team Membership

Originally published at http://bit.ly/OPyMVn The team in Dynamics CRM 2011 provides an ability to group users, assign record ownership to a group of users, and extend security roles to users based on their team membership (as opposed to individually assigning the role.) Teams in Dynamics CRM 2011: A team is a group of users. This organizational structure enables groups of users across an organization to share information. Each team must be associated with only one business unit. A team can include users from any business unit, not only the business unit with which the team is associated. Users can be associated with more than one team. More details can be found in the Dynamics CRM 2011 SDK Documentation. Beyond allowing cross-business unit record access and assignment of security roles, the Team entity can provide a simple way to create a group of users. ...

August 11, 2012 · 3 min · Nicolas Nowinski