CRM 2013 Solution Export Issue


Recently I was having problems exporting a solution from an on-premise CRM 2013 organisation. Unusually there was no additional log to download and turning on verbose logging allowed me to see the exception being thrown on export but there was no indication to the source of the error.

I eventually resolved the problem by process of elimination, removing likely candidates from the solution until I could export successfully. It turned out to be an errant Routing Rule Set which was configured for forwarding to a queue but the queue wasn’t defined. Since you can’t create a rule and forward to a queue without defining the queue, I assume it must be due to the solution having originally been imported unmanaged and the queue name defined in the Rule Set not existing on import.

If you’re struggling with a solution export, import or delete I’d recommend verifying the Routing Rule Sets and Case Creation Rules first.


systemform With Id = {guid} Does Not Exist


Solution Import Error systemform With Id = {guid} Does Not Exist

I was struggling with this error recently whilst trying to import a managed solution into a CRM 2013 SP1 integration environment.  It turns out that the form that it was telling me didn’t exist was a Quick Form that did!

Having confirmed the form existed in the org and solution I exported from I decided to open up the zip file to have a look through the customizations.xml file. I searched for the guid and could see that the Quick View form was as expected included correctly and the reference to it from the related form was also included.

The only thing I could think was that the form that referenced the quick view form was included in the Xml before the actual form that contained the quick view definition. I moved the element containing the quick view form above the that was referencing it, repackaged and tried again. This time the import work successfully!


  1. Open up your solution zip and edit the customizations.xml file searching for the guid provided in the solution import error log.

  2. For each <Entity> that uses the Quick Form you’ll see it contains a <QuickFormIds> element similar to that shown below.  You need to make sure that the <Entity> element for the entity it refers to (xyz_entityName in this case) appears in the file BEFORE the <Entity> that is referencing it via the QuickFormIds element.

<QuickFormIds><QuickFormId entityname=”xyz_entityName”>33d82ce4-0648-477c-a1b8-08ddd4b6e5be</QuickFormId></QuickFormIds>

Looks like a bug that will hopefully get sorted in the next rollup.

CRM 2011 SDK Dependency Starter now on Nuget


Each time I want to create a quick project in Visual Studio to connect to CRM 2011 I head to the SDK and pull in Microsoft.Xrm.Sdk then the source code for the helper classes and finally resolve all the missing framework dependencies IdentityModel, DirectoryServices etc.  The latter being made considerably easier with Resharper.

I’ve been meaning to package up this process that I’ve now repeated far too many times and throw it up on Nuget.  I finally managed to find the huge 10 minute commitment it eventually took to get this done tonight.

Available on the gallery or to install the package in Visual Studio just open up the Package Manager console and type:

install-package CRMSDKDependencyStarter

or for those of us averse to typing you can shorten this with:

install-p [tab] crm [tab] 

Error when saving URL addressed record in CRM 2011 (Rollup 5)


If you’re on Rollup 6 or higher you can ignore this post.

I came across a problem today when loading a record using the URL addressable form feature as documented over on the Microsoft site here. The record would load fine but when I tried saved the record the page wouldn’t refresh correctly. I would end up with a disabled ribbon and no other page content! The save operation was however succeeding.

I traced this down to an exception being thrown from within the platform JavaScript code. It was making the assumption that the querystring value extraqs was available and calling string.startsWith()which was throwing the null exception.

If you take a look at the URL for any entity loaded via a hyperlink in CRM they all contain this parameter which is typically used to pass attribute values to a form so those values can be pre-populated on load. The value of this parameter must be URL encoded.

Here’s a contact loaded from the default Homepage grid:


Here’s the sample URL provided for loading an account on the MSDN article linked above:

Switching out the values in blue for environment specific values you’ll see that the record will load correctly. However, if you then make a change and click save the page will hang as show below.


Reformatting the sample URL as follows (bolded) will fix the issue when saving the record.


Custom Web Pages with CRM 2011 Look and Feel using knockout.js


In this post (it’s been a while!) I’m looking at building a custom html page (ISV hosted or otherwise) that looks as close as possible to the CRM lookup dialog. This will allow us to provide our users with a seamless experience when moving from OOB functionality to custom web pages as was needed on a recent project.

For those that would prefer to skip the how and why and just get the code it’s available on github. Simply plug your data into lookupForm.js along with optional actions for the buttons and away you go. How you choose to get the data into the viewModel is entirely up to you.

This is what we’re trying to reproduce, but outside CRM.

Unfortunately there aren’t any stylesheet or html resources available in the SDK to help us achieve this. There are a set of articles that discuss UX guidelines which are worth a read but none of this information is backed up by reusable templates.

What I needed was a stripped down version of the CRM lookup into which I could add my own code. I found a project created by Darren Lui on Codeplex that is essentially a screen scrape of the HTML and dependent stylesheets for the common forms. It’s a great start but it was missing a number of features I wanted.

Required Features


The pages in the template project are a copy of the actual html generated by CRM and therefore it’s a bit tricky to work out exactly where you need to inject your own content and markup into this. CRM 2011 relies heavily on tables for layout so any html purists out there may want to look away now.

Data Separation

I didn’t want to start doing string concatenation to build my html from the data. I wanted to be able to provide the dialog with my own data without having to touch the html and let it build out the page for me. Ideally this should be achieved without the dependency on a server-side framework (ASP.NET). To achieve this I used knockout.js, the MVVM JavaScript framework written by the incredibly smart Steven Sanderson. It allows you to produce a view model in JavaScript and bind this to your html through declarative bindings using the html 5 data-* attributes (don’t worry they’re fully backward compatible to IE6).


The stylesheets used in CRM are quite large and take dependencies on several server-side *.htc files (global.css is 245k incl. all the CSS sprites).

Strip out the html we don’t need from Darren’s template

This was a just a case of stepping through the code bit by bit removing sections and checking the effect of their absence. Not too difficult just quite time consuming. There are many nested tables used in CRM along with custom attributes and as I’ve already mentioned a lot of them exist to provide the rich user experience that I’m not trying to replicate here. Including the knockout bindings and some superfluous commented html the final page is approx. 172 lines rather than the original 492. The size isn’t the issue but the less unnecessary html we have in there in the first place the easier this is going to be for reuse and maintenance by other developers.

Add the declarative bindings (Yes, it’s a screenshot!)

The new container-less bindings available in knockout were used for generating the rows of data dynamically. The much pared down html for generating the data rows is shown below.

Create our View Model in a separate JavaScript file

I created this so that each area of the page that requires data or behaviour is configured on the view model. The code will hopefully be self-explanatory but essentially the column headings are dictated by the headings property, the data rows are in the entities property and the actions bound to the click of each button are bound in the actions object. At the time of writing, the disabling or hiding of buttons isn’t implemented but this will be easy to do using knockout and may well have appeared in the code by the time you read this.

Sort out the StyleSheets

The dialog uses styles from the following stylesheets:










These have all been parsed and the minimum styles required for the dialog have been exported to a single file called lookupForm.css. To reduce the number of dependent files further I’ve also base 64 encoded the button background images used so they are in-lined in the CSS. I’ve also removed all references to the CRM *.htc files.

The end result

Next Steps

  • Bundle this up as a CRM 2011 Solution.
  • Configurable or dynamic column widths based on the data in the column.
  • Due to the removal of all the htc resources the horizontal scrolling of the column headers doesn’t work. I need to look at the best way to re-implement this feature.


I’m not going to spend much more time on this as its application is pretty specific. In using it you’d need to consider the affect if CRM styles changes. It’s only been tested in IE which is fine at the moment but when the 2012 Q2 rollout drops with support for Chrome, Firefox and mobile you’ll need to consider the effort involved in updating this solution to work in those browsers. Having said this hopefully it will prove useful to others.


As I published this I’ve also added the ability to show or hide the checkbox and define an image for each row.

CRM 4.0 and WCF Data Services


UPDATE: The below post has been sat in my drafts since March 2011. Not sure why I didn’t post it given the title of this site does contain the word musings! Anyway, 6 months on and two projects later I can summarise the Advanced Developer Toolkit as it’s known as follows:

It’s considerably better than Fetch-Xml but still has limitations given that it is essentially talking directly to the Web Services. Make fiddler your best friend and keep a close eye on the queries you’re producing. The expressions the API is building underneath are more than happy to produce pseudo select n+1 and given these are against the web servies this is very bad if you let it get out of control.

Managing the push of entity schema changes made in CRM into the typed entities produced by crmsvcutil can be a pain. However with a suitable build process in place and having setup the deployment of the binary through a corporate NuGet feed I have the deployment workflow setup pretty slick for us now.

The original post I failed to post back in March follows:
I can see a requirement dropping on us in the near future for exposing the contacts in our new CRM 4.0 system to the wider world. The wider world being other divisions within the organisation.

I’m not a CRM expert as we “got a man in” for that bit and one of the other devs on the team picked up the work with him. I am familiar with the plug-in architecture and the WS- based Fetch XML API into CRM having written a replication service from one of our legacy databases.

So, back to the point. We think we’re going to see a need for some querying capability over our CRM data and having had experience of the web services exposed by CRM I immediately decided that pointing the development teams of our other divisions at that API probably wasn’t ideal.

We need options and in this world of LINQ to absolutely everything I decided IQueryable needed to come to my rescue as there must surely be some form of LINQ provider available provided as either open source or better still through Microsoft. A quick Google came up with a project on CodePlex that whilst flagged as deprecated I was pleased to see its reason for deprecation was that Microsoft’s v4.0 of the CRM SDK included a LINQ to CRM Provider. Superb!