Tag Archives: Dynamics

The BEST SiteMap editor you probably don’t know about

One of the keys to being a more productive CRM developer is knowing what community tools are out there.  Sometimes, as soon as you think you have a favorite tool, you find another one that makes you smile.  Hopefully, I’m helping create one of those moments for you.  I’ve blogged about CRM Solution Manager before.  CRM Solution Manager comes with what I think is THE BEST SiteMap editor I’ve come across.  It’s a VISUAL editor in the spirit of Visual Ribbon Editor and Ribbon Workbench

image

What you probably don’t know is that while you get this editor when you purchase CRM Solution Manager, the author makes the SiteMap tool available for FREE.  Yep, that’s right.  No strings attached.  Just go to the downloads page and you will find it hiding in plain sight! 

image

What are you waiting for?  Go get it!

@devkeydet

The ultimate documentation tool for Dynamics CRM 2011

SnapShot! for Dynamics CRM – http://www.crmaccelerators.net/products/snapshot-for-dynamics-crm

…extracts and consolidates the following components:

  • System Settings
  • Entities
  • Fields
  • Relationships
  • Views
  • Forms
  • Option Sets
  • Field Security
  • Security Roles
  • Solutions
  • Web Resources
  • Plugins
  • Processes
  • Templates
  • Business units
  • Users
  • Teams
  • Queues

I’ve had customers ask for something like this many times!  Good to know I have an answer for them now!

@devkeydet

Developing CRM 2011 customizations without a local server

I’ve spent a lot of time over the last year applying my general application development experience to the world of Dynamics CRM customizations (aka XRM).  Often, I take part in conversations that go something like “Why is X harder to do when customizing Dynamics CRM compared to general .NET web development?”  I usually respond with “Well how exactly are you doing X?”  After finding out, my next response is usually along the lines of “Well have you thought about doing it like Y instead?  That’s a much more productive way.”  The next response is usually “Well, why isn’t that documented somewhere?”  My answer is usually “Well, it’s really just applying proven development practices to CRM.”  These conversations are usually the catalyst for many of my blog posts.  Sorry for the contextual tangent.  Back to the point of this post.

When I first started focusing on Dynamics CRM about a year ago, I was adamant about developing in an isolated VM which included the CRM Server installed (if at all possible).  The main reasons were:

  • Developing in isolation from others
  • Ability to attach to the necessary processes to debug plugins and workflow activities
  • Speed of deploying web resources / plugins to the server through the developer toolkit (no network latency slowing the process down)
  • Ability to create/delete CRM organizations on the fly for prototyping, starting from a clean environment, etc.

I still believe this is the best setup for CRM developers.  However, I also recognize that many folks don’t have the hardware resources to give each of their developers a machine that can handle such an environment. 

I’ve been asked quite a few times “Why isn’t there a lightweight dev server for CRM like there is for ASP.NET?”  That’s a much longer discussion.  It’s the same basic answer as why SharePoint and other server products with APIs don’t have one.  However, what I think people really want is to be productive developing without having to install the full fledged server locally.  As I was building out the walkthroughs for my posts on unit testing:

… I had a bit of “DUH” or “AHA” moment.  If you practice Test Driven Development (TDD) using these approaches, go with the one org per developer approach on a remote server, and sprinkle in effective team development approaches enabled through Solution Packager, then you can become quite productive developing without a local server.  Your remote server becomes your integration testing environment. 

I still prefer doing all of the above in a local, isolated VM environment.  There’s nobody else playing in my sandboxSmile.  However, when you don’t have the luxury of installing CRM locally, I’ve learned that the combination of these approaches against a remote server can be a surprisingly productive setup.  I’ve been forcing myself to use this approach lately, even in a local VM.  It does take some getting used to.  I call this the “up front setup/config tax.”  Once you’ve paid the tax and get into a rhythm doing things this way, I think you will appreciate the efficiencies gained.  Try it out.  Let me know your thoughts.

@devkeydet

Unit testing CRM 2011 JavaScript web resources

UPDATE: Fixed the video resolution issue.  Higher resolution (720p) version is available.

After writing my post on unit testing plugins, I’ve been asked a few times about how to do the same for Dynamics CRM 2011 JavaScript web resources.  While I knew it could be done, truth be told, I had never done any significant JavaScript unit test using Visual Studio other than unit testing Script# code using MSTest (the default unit testing framework in Visual Studio).  Sure, I had played around with QUnit.  However, QUnit is one of those JavaScript testing frameworks which requires tests to run within a browser.  What I wanted was an approach which met the following criteria:

  • Integrate with MSTest so:
    • I have one test dashboard for both my plugin & JavaScript unit tests
    • I get as much of the TFS integration goodness I can get
      • Gated check-ins
      • Running tests on a build server
      • Etc.
  • Write and debug my code without having to constantly deploy to a CRM server to test and iterate on my code
  • Mock things like Xrm.Page, web service calls, interaction with the HTML DOM, etc.
  • Integrate with the Developer Toolkit
  • Run tests OUTSIDE of the context of a browser

So I scoured the internet, tried a bunch of things I came across, and finally landed on approach which combines lessons learned from the following resources:

While the catalyst for this video was to demonstrate JavaScript unit testing in the context of Dynamics CRM 2011, the approach can be applied to any scenario where you are using JavaScript and some additional API (SharePoint, standard web app, etc.).

Just like with my post on unit testing plugins, it is not my goal here to convince you that you should embrace unit testing.  It’s for those of you who have already bought into the value of unit testing, want to apply it to JavaScript web resource development, and do it in a way that meets my stated criteria above.  In the video, I assume you understand concepts like mocks, fakes, etc. 

You can grab the finished example I show in the walkthrough here:

http://sdrv.ms/StxcgU

Hope this helps those of you who have been as eager as I have to unit test JavaScript web resources.

@devkeydet

WEBCAST: CRM 2011 Team Development With Shan McArthur

UPDATE: If you missed the webcast, you can watch the recording via the details link below.

Team development for Dynamics CRM 2011 customizations is a topic I get into often with customers and partners.  The best, most comprehensive session I have seen on team development with Dynamics CRM 2011 was delivered by Shan McArthur (blog, twitter) at eXtreme CRM (Las Vegas) this year.  My biggest frustration about his session was that only the people at eXtreme CRM could benefit from knowledge he was sharing.  Good news!  Shan’s delivering an updated and extended (2 hour) session on this topic for the XRM Virtual User Group on 11/29/2012 (sorry for the short notice).  Details here:

http://www.xrmvirtual.com/events/team_dev_ShanMc_CRM2011

This is a MUST SEE webcast in my opinion.  Watching it just may improve your life as a Dynamics CRM developer.

NOTE: The “Register for Event” button will be disabled unless you are signed in to the site.  Have no fear, there is also a “Attend Live Meeting Here” link on the page in the event you are undecided about becoming a member.  If you aren’t a member, you should be (it’s free). 

@devkeydet

How I develop and unit test CRM 2011 plugins

This is probably the most promised, but never published blog post on my list of potential posts.  I’ve managed to convince enough CRM developers I’ve run into that they should get some test driven development with unit testing religion.  Especially because of the added productivity benefits for CRM plugin development.  This post isn’t to convince you of the benefits of unit testing.  There are plenty of articles/blogs which cover that topic just fine.  I’m not interested in debating the virtues of unit testing.  Love it or leave it;). 

The purpose of this post/video is to show you how I develop and unit test plugins.  There are a few articles out there about how to unit test CRM 2011 plugins.  I haven’t been satisfied with the approaches I’ve seen.  I landed on an approach which combines using the CRM 2011 Plugin Testing Tools for mocking IServiceProvider and Moles fore detouring types used inside the plugin which are difficult or time consuming to mock such as OrganizationServiceContext, Web Service calls, and others.

You can grab the finished example here:

http://sdrv.ms/StxcgU

You can also grab the starter solution I mention in the video here:

http://sdrv.ms/ScFUNf

Once you’ve learned the basics in the video, hop on over to the series below for some more advanced examples:

http://zhongchenzhou.wordpress.com/2012/07/08/dynamics-crm-2011-unit-test-part-1-introduction-and-series-contents/

The series above focuses on using Fakes in VS2012.  Fakes is the successor to Moles. However, the general techniques still apply whether using Fakes/Moles.  If you are using VS2012, then use Fakes.  If you are using VS2010, then use Moles.

I find many people who are new to unit testing have questions about where it fits in relation to other forms of testing.  Unit testing does not replace other forms of testing such as integration testing (i.e. testing the plugin running in CRM).  TDD through unit testing is an upfront developer discipline.  It requires a certain culture and mindset on a dev team.  In my opinion and experience, it helps me produce better code and allows me to catch more (not all) bugs early on, before handing things off to other testers.  It also makes the others testers lives/jobs easier. 

When applying this approach to CRM plugins, there’s a bonus side effect that (for me) allows me to be more productive in authoring my plugin code because I can:

  • Iterate (make code changes, build, debug and/or test, repeat) rapidly without needing to deploy to a CRM server
  • Iterate on my code rapidly without affecting the external systems
  • Use code coverage to identify untested scenarios which enable me to build better, more complete tests. 
    • This, in turn, allows me to build better, less buggy code.
  • The nature of having a suite of automated tests allows you to identify issues and regressions in your code early on as you make changes
    • This becomes more and more valuable over time as you build out your plugins and corresponding tests
  • Other devs don’t have to know how to test your code.  They just run the tests you’ve written

@devkeydet

The Dynamics CRM resource so many have been looking for

http://www.crmfieldguide.com/

The CRM Field Guide is an essential guide to Microsoft Dynamics CRM that everyone should have on their bookshelf. This book offers you details not only on CRM fundamentals and extensibility points but also the tried and true best practices and strategies of the combined experience of some of the most recognizable global experts in the CRM industry. The field guide contains insights from many CRM MVP contributors and is intended to be a book you pick up over and over again as you use CRM.

This book was announced at eXtremeCRM. While I haven’t read it yet myself, it appears to be a resource many of us have been hoping would come about.  Julie Yack has a blog post explaining the genesis of the book:

http://julieyack.blogs.com/my_weblog/2012/10/introducing-the-crm-field-guide-1029-days-in-the-making-crmfieldguide.html

I just bought the electronic copy.  I’m looking forward to reading it.

@devkeydet

CRM 2011, Visual Studio, and Source Control of non-code customizations

In the latest release of the Dynamics CRM 2011 SDK, a new tool was introduced which creates new options for how teams can source control their non-code customizations.  The tool is called SolutionPackager.  I encourage you to read the following SDK documentation:

Solution Tools for Team Development

As the documentation states:

“The tool identifies individual components in the compressed solution file and extracts them out to individual files. The tool can also re-create a solution file by packing the files that had been previously extracted. This enables multiple people to work independently on a single solution and extract their changes into a common location. Because each component in the solution file is broken into multiple files, it becomes possible to merge customizations without overwriting prior changes. A secondary use of the SolutionPackager tool is that it can be invoked from an automated build process to generate a compressed solution file from previously extracted component files without needing an active Microsoft Dynamics CRM server.”

I recommend you thoroughly read through the SDK documentation before continuing.  I will not explain SolutionPackager in great detail since the documentation does a good job of that already.

Since SolutionPackager is a cmd line based tool, it can be used to integrate with any source control system.  However, most Visual Studio developers probably want to integrate SolutionPackager into Visual Studio.  Furthermore, most probably want to integrate it with the Developer Toolkit for 2011.  The video below walks you through a sample I built which demonstrates how to do just that.  You can download my completed sample here.

@devkeydet

UPDATED SAMPLE: CRM 2011 Windows Store App OData helper

I worked with a partner, EastBanc Technologies, who used the approach I blogged about here and here to build a Windows Store App for a Dynamics CRM solution.  The folks at EastBanc Technologies found some bugs.  We worked together to fix the bugs and they were gracious enough to let me share their changes.  I’ve uploaded the updated sample here:

Visual Studio 2012 Source Code: http://sdrv.ms/S3MND1

CRM Unmanaged Solution: http://sdrv.ms/RYzVzj

You will need the WCF Data Services Tools for Windows Store Apps and Visual Studio 2012 RTM.

If you’ve followed the two previous posts, you’ll notice that I uploaded my samples to new location on my SkyDrive.  The reason is that due to the final terminology for Windows Store Apps, I needed to refactor the solution/project files and class names.  While I plan on updating the walkthrough post when I have a spare moment, I wanted to get the changes published.  Hopefully, the naming changes are obvious enough for folks until I get that post updated.

@devkeydet

Building VB.NET plugins with the developer toolkit

Scenario:

“I’ve seen the Developer Toolkit for Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online, but it only ships with C# templates.  I’m a VB.NET developer.  How can I get the developer productivity from the toolkit while still writing my plugin code using VB.NET?”

The good news is that SDK obviously supports VB.NET.  The .NET Framework has always allowed you can make calls from C# code to VB.NET code through assembly reference.  Therefore, we can devise a strategy to just make the generated C# code from the toolkit the entry point, but put our plugin code in a referenced VB.NET assembly.

“But my plugin assemblies are sandboxed and database deployed which don’t support referencing other assemblies.”

True, but there’s this wonderful little tool called ILMerge (also available through NuGet).  With ILMerge and a little refactoring, we can achieve this scenario and VB.NET developers can use their language of choice with the developer toolkit.  Here’s a video with step by step instructions.  I use ReSharper in the video to make the refactoring easier.  Everyone who knows me knows I swear by ReSharper, but I understand not everyone loves it like I do or has the budget to acquire it.  I do my best to call out what you’d need to do manually, but you might have to pause now and then if you want to follow along step by step.

You can download the Visual Studio solution that is the output of the walkthrough here.  Reuse it or just grab the post build commands to get this setup yourself, etc.  Hope this helps anyone looking to get more productive with plugin development using VB.NET and the developer toolkit.

@devkeydet