Tag Archives: CRM

MSDN Magazine Article: Building Government Business Applications with Microsoft Dynamics CRM

I happy to share that the article Andy Schultz (@andrewbschultz) and I coauthored for the MSDN Magazine – Special Government Issue,  Oct 2013 has been published.  You can read the entire issue here:


The article we wrote is titled Building Government Business Applications with Microsoft Dynamics CRM and is available here:


We set out to write an article that would not only appeal to MSDN Magazine’s core audience, .NET developers, but one that would also resonate with Technical Decision Makers (TDMs).   While this article is in MSDN Magazine, it is intentionally not deeply technical.  The article is an attempt to represent the narrative we typically share with our US Public Sector customers and partners about why they should consider building their business applications on Dynamics CRM. 


Debugging CRM web resources without ever deploying them

UPDATE: The steps explained below don’t work with CRM 2013.  However, Scott has a blog post which shows you how to get it working again:


One of my last posts was sharing how I use Visual Studio to debug CRM web resources:


This approach was one of those discoveries that makes us developer types get a little excited because it allows us to do something we do repeatedly in a much more efficient fashion.  I just came across another one of those EUREKA moments thanks to Scott Durow (@scottdurow) and some his promising new http://www.sparklexrm.com project. 

BTW, Scott’s the man behind Ribbon Workbench for Dynamics CRM.  It’s the best Ribbon editor out there in my opinion.  I digress…

I was reading through http://www.sparklexrm.com/s/Tutorials/SetUpNewProject.html and discovered a little gift from Scott at the end of the walkthrough.  Steps 9-14 explain how to use www.fiddler2.com to let you debug changes to web resources without ever having to deploy them to Dynamics CRM.  How?  Steps 9-14 explain it.

Combine this with my post on F5 debugging from Visual Studio and you nearly have web resource developer productivity nirvana.  I just tried combining the two approaches.  It works beautifully!  I was able to make changes to JavaScript, hit F5, debug right in Visual Studio, and repeat over and over again.  I did this all without ever having to deploy the JavaScript file to the server.  Because of it, I was able to iterate on my changes in a fraction of the time CRM developer typically spend.  Try it yourself!


EUREKA: F5 debugging of CRM JavaScript web resources


“Internet Explorer F12 JavaScript debugger is great, but I use Visual Studio.  I want to be able to set breakpoints in my JavaScript web resources which I author in Visual Studio, then hit F5 on the keyboard or Debug->Start Debugging from the menu or the Play Button on my toolbar just like I do with all other types of development in Visual Studio.  Visual Studio should then launch the right CRM url, attach its JavaScript debugger, and my breakpoints should be hit.”

This is the #1 piece of feedback I hear from the customers/partners/ISVs with whom I work.  I’ve always told people it’s not possible.  I just realized how wrong I am.  Given that I’ve used every version Visual Studio since it was first released, I am a little embarrassed to say I just had this “A HA!” moment.  Better late than neverSmile

As I mentioned in this post, I have stopped using the Developer Toolkit for Microsoft Dynamics CRM for web resource authoring in favor of the CRM 2011 Web Resource Linker/Publisher.  Note, I still use the developer toolkit for plugin / workflow activity authoring.  As I state in the post about the web resource linker tool, since it allows you to keep all of your web resources in a standard web project in VS, you get all the benefits of web project capabilities including other addons that work with web projects.  It’s this premise which brought me to my “A HA!” moment.  Below is a video walkthrough of getting this scenario working:


You can install the jQuery Code Snippets from:



North 52 Formula Manager = WOW

DISCLAIMER: This is my opinion.  I get nothing from the makers of this addon for expressing my opinion. 

I’m a developer at heart.  I love writing code.  But I also abelieve in the “don’t write code unless you have to” philosophy.  Well, I finally got around to playing around with North 52 Formula Manager and watch most of the YouTube Videos.  All I can say is WOW.  This addon is the answer to so many “Why can’t you do that with CRM without writing code?” questions.  Frankly, I can’t think of any CRM/XRM app that WOULDN’T benefit from this addon.  I also can’t rationalize writing code when I know I can use this addon to implement so many scenarios faster.  You owe it to yourself to take a look at this addon.  Review their site and watch the videos.  I suspect you won’t be disappointed you did.  Even with this addon, there will still be times when you will need to write JavaScript and .NET plugin code.  However, the scenarios will be far fewer.


Convergence 2013 Recordings

As Girish says in his post:

“If you didn’t attend Convergence 2013, you can still watch the recording of the keynotes and breakout sessions by registering for the Virtual Convergence. Best part is that it is completely free!”

More details here:



CRM and SQL 2012 AlwaysOn Availability Groups

I’ve spent a fair amount of time lately talking to people about the benefits of using SQL Server 2012 AlwaysOn Availability Groups in your CRM infrastructure.  I just came across a great video that’s a great primer on AlwaysOn Availability Groups:


Here is a link to the SQL documentation as well:


AlwaysOn is already used in CRM Online for both local failover/redundancy and geographically distributed failover/redundancy for disaster recovery.  As of Update Rollup 12 for Microsoft Dynamics CRM 2011, the implementation guide has been updated with AlwayOn guidance:


One of the nice features of AlwaysOn is Active Secondaries: Readable Secondary Replicas (AlwaysOn Availability Groups).   You can configure custom reports to use the readable replica.  Here’s a good blog post on the topic:


Make sure you read the limitations of this approach stated in the blog post.  You should evaluate the feasibility of using this approach to determine whether the benefits are applicable to you. 


TOOL HIGHLIGHT: CRM 2011 Web Resource Linker/Publisher

I’ve blogged previously about why I like the approach CRM Solution Manager uses for authoring web resources in Visual Studio.  While I think CRM Solution Manager is a fantastic tool, there are ways to get some of the benefits of it’s approach to web resource authoring with a couple other free Visual Studio addins.  The first tool is CRM 2011 Web Resource Linker/Publisher.  This tool provides the ability to map a file in a Visual Studio project to a web resource in CRM.  Because of this, I can organize my scripts in a folder structure which aligns with the relative path naming convention that’s recommended in the CRM SDK.  See http://msdn.microsoft.com/en-us/library/gg309536.aspx for more details.  In the picture below, I just started with an empty web app and added the dkdt_ structure below:


Then, I simply link/publish the files:


Here’s an example of what initial linking looks like:


Notice that you can also create a new web resource right from the linker dialog.  Once you’ve linked the files, you can do things like multi-select in Solution Explorer and deploy/publish just the files you care about:


But wait, there’s more.  Since this is just a standard web app project, I can take advantage of all the goodness that Visual Studio 2012 has to offer.  For example, I can use NuGet to add the CRM 2011 Client Side VSDoc to get JavaScript Intellisense for Xrm.Page and simply drag and drop the file from Solution Explorer to the open JavaScript file that needs Intellisense and Visual Studio takes care of adding the reference:


I can also take advantage of addins which are designed to work with web projects such as Web Essentials 2012.  One example is the JavaScript Minification feature:


…which will give me a production optimized version of my JavaScript file.  Because these are just files, I can just relink if I want to test the minified version.  To hit home the “because they are just files” point, I’ll give you another example.  I’ve grown fond of TypeScript.  There’s even an Xrm.Page TypeScript definition file.  Because TypeScript ultimately produces JavaScript files, those files can simply be linked/published.  I think you are starting to see the “it just works” pattern here.

So, for me, I’ve stopped using the Developer Toolkit for Microsoft Dynamics CRM to Create and Deploy Web Resources because many of these things I talk about don’t work with the supplied template.  Furthermore, the Developer Toolkit forces you to deploy all of your web resources every time and it doesn’t publish.  You have to do that manually.  I’ve found the approach I lay out in this post to be the most productive way of using Visual Studio to develop web resources.  However, I still use the Developer Toolkit to Create and Deploy Plug-ins and Create and Deploy Workflow Libraries.



Authenticating to an Azure hosted web service from CRM Online Sandbox code

UPDATE (14MAR2013): Uploaded a modified sample which addresses storing credentials in secure config and adds comments around how to encrypt those credentials.  While I show a synchronous plugin in the demo for simplicity of the walkthrough, you should always evaluate whether your plugin logic can fire asynchronously if the action doesn’t require that the user see the result of the action immediately after the record is saved.  Calling an external system from a synchronous plugin can have negative side effects for both user experience and tight coupling with the external system.  When you absolutely must use a synchronous plugin, make sure your code is short lived and try to put your azure web role in a data center as close to your CRM Online data center as possible to minimize network latency.  You should also weigh the pros / cons of using this approach over the inherent Azure Service Bust capabilities Dynamics CRM provides which I talk about in my Integrating with systems behind a firewall from CRM Online using Windows Azure Service Bus Relay post.  While the context of my post is talking to systems behind a firewall, you can also use Azure Service Bus as a mechanism to integrate with a web service running in Windows Azure.  As of the CRM Online December 2012 Service Update and Update Rollup 12, Dynamics CRM includes new support for Windows Azure persistent queues, use of the updated Windows Azure portal to configure ACS, and synchronous plug-in support for posting to the service bus. 


“I need to execute some code from a plugin which requires full trust.  CRM Online doesn’t give me the ability to run full trust code so I want to put my full trust code behind a web service running in a Windows Azure Web Role.  However, every approach I attempt to use to authenticate from the plugin to the web service fails due to sandbox issues.”

While I thought I covered this in my Design for Online post, I learned that my assumptions were incorrect.  I was under then impression that the approach I mention explained in the SharePoint Online and Windows Azure: Developing Secure BCS Connections using WCF Services post which uses UserNamePasswordValidator class would work in CRM Online.  I swear I had it working at one point.  That’s what they all say:).  I recently tried it again and discovered that the client code (the code running in the plugin) required full trust.  I couldn’t figure out a way to get this working in full trust.  I still don’t know why this requires full trust and my attempts at finding an explanation internally at Microsoft came up short.  If someone else has gotten this approach to work, then I would love to know what I am missing. 

Anyway, I had originally been going down a SOAP based approach.  I actually had a sample working from a sandboxed plugin using custom SOAP headers similar to what’s described here.  If you are adamant about wanting to use SOAP, then take a look.  If there’s sufficient comments asking for a SOAP based example, then I will try to find the time to write a post about it.  However, what I realized after I got it all working was that the aforementioned approach is complex and hard to follow.  I saw this as an opportunity to take advantage of the ASP.NET Web API.  I think you’ll find the ASP.NET Web API approach more optimal for this scenario because:

  • We want as efficient communication as possible between CRM Online and the Windows Azure web role.  REST+JSON is the most efficient way I know.
  • ASP.NET Web API makes it really easy to use JSON as the serialization format.
  • It’s pretty easy to implement basic authentication for ASP.NET Web API based services.
  • Basic authentication can be used from a sandbox plugin

Before watching this walkthrough, make sure you go through or at least understand the following ASP.NET Web API walkthroughs:





Watch the following video once you’ve gotten up to speed using ASP.NET Web API:

The video won’t make much sense if you don’t spend the time understanding ASP.NET Web API.  The code sample I show in the video is available here:



Microsoft CRM Enterprise Academy

I work with enterprise customers and have been involved in a number of enterprise implementations of Dynamics CRM.  One of the #1 things I get asked all the time is “where is the enterprise CRM training?”  The Microsoft CRM Enterprise Academy is a 5-day instructor-led training which provides 300 level Advanced Development and Advanced Infrastructure content for Microsoft Dynamics CRM 2011 to help address the unique needs of enterprise customers.  Go to http://regonline.com/CRM2013 for full details and registration information.