Unable to cast object of type ‘xxxx’ to type ‘Microsoft.Crm.Sdk.IPlugin’

We recently ran into some issues during one of our CRM 2011 installations. To give you some more background info, this particular installation was a fresh installation of CRM 2011 based on an upgraded CRM 4.0 installation.

The upgrades we did in the past went fine; the only difference with this one is the fact that it was not an upgrade, but a complete new installation.

After the installation and uploading our solutions, I tried a first test to see if all plugins and custom code was running OK. But unfortunately the test failed on the first run.

The exception I received was: Unable to cast object of type ‘xxxx’ to type ‘Microsoft.Crm.Sdk.IPlugin’

I’ve spent hours trying to figure out what was wrong here. I first tried adding some of the old CRM 4.0 assemblies to the GAC, recompiling the plugins so that they use to x64 assembly references, but all with little luck.

I suddenly got the idea to compare the new installation with one of the successfully upgraded installations and this got me to the Web.config file of the CRM website.

It seems the following section was missing in my web.config file:

 <assemblyBinding xmlns=urn:schemas-microsoft-com:asm.v1>
<assemblyIdentity name=Microsoft.Crm.SdkpublicKeyToken=31bf3856ad364e35culture=neutral />
<bindingRedirect oldVersion= />

After adding this section at the bottom of the Web.config, all my plugins were executing without any issues. Not sure where this section came from, if MS automatically injects it during an upgrade or not.

Anyway, this seemed to solve the issue for me.



Tagged with: , ,
Posted in CRM 2011

Installing the Dynamics NAV 2009 Middle tier on a CRM Server might break CRM

Installing the NAV 2009 middle tier on an existing CRM server using a multi-server approach can cause some issues in regards to the SQL server security.

When your NAV 2009 service tier is running on a different computer than the SQL server, you must enable the Object Change Listener (http://msdn.microsoft.com/en-us/library/dd568739.aspx)

In my case, I was using the Network Service account to run my NAV services, which means I had to set the Machine name in all the stored procedures required for the setup.
Doing so seemed to mess up my CRM installation. My computer account was still a member of the standard SQLAccessGroup and the PrivUserGroup, but all of a sudden I ran into the following errors when opening CRM.

Exception message: Cannot open database “CRMTest_MSCRM” requested by the login. The login failed.

Login failed for user ‘DOMAIN\COMPUTERNAME$’.

Exception message: The SELECT permission was denied on the object ‘ConfigurationMetadata’, database ‘MSCRM_CONFIG’, schema ‘dbo’.

It seemed that adding this computer account to the SQL security overruled the group security set in SQL.

To solve this I just set the same user mappings on my Computer account than on the SQL Access Group, which is public and db_owner on the MSCRM_CONFIG and CRM organization database as shown below.

I could have also set the NAV services to run as a dedicated domain user account.
Don’t think it would have caused any problems setting it up in such a way J

Tagged with: , , ,
Posted in CRM 2011, NAV

Walkthrough: Capturing the GUID Values of Records Selected in a Grid (CRM 2011 Edition)

You might remember this one from the SDK for CRM 4.0. Doing the same steps as described here won’t get you there for CRM 2011. It seems the dialogArguments no longer contain the selected Guids.

It took me a while to figure this out since there was no entry explaining this in the CRM 2011 SDK. Putting it all together got me there finally.

It all starts of course by adding a new ribbon button to the corresponding grid you would like to get the selected items from. I won’t get into details here on how to do that.
Once you have the button and command definitions in place, it might look something like this:

<CommandDefinition Id="NORRIQ.nrq_customentity.Grid.ButtonProcess">
<EnableRule Id="Mscrm.Enabled" />
<DisplayRules />
<Url Address ="$webresource:nrq_/ProcessCustomEntity.htm" WinMode="1" WinParams="dialogWidth:400px;dialogHeight:200px" >
<CrmParameter Name="data" Value="SelectedControlSelectedItemIds" />

You should especially take a look at the CrmParameter element of the XML. When adding an action of type URL, any parameter you pass should be called data.

This is not really mentioned in the SDK under the <CrmParameter> (RibbonDiffXml) section. It does state here that you should call it data, as I can expect you would also want to call external URL’s.

When the CrmParameter is a child of the <Url> (RibbonDiffXml) a Name attribute is required. When the CrmParameter is a child of the <JavaScriptFunction> (RibbonDiffXml) element, the Name attribute is not valid.

Looking a bit further in the SDK you will end up in the Web Page (HTML) Web Resources section which then states that a Web Page resource can only accept and additional parameter called data. For more info check here.

After figuring this out I was sure to get the SelectedControlSelectedItemIds parameter passed to my web page in the data parameter.

You can now break down this data parameter in your web page with a simple JavaScript function like the following:

function GetSelectedIds() {
var vals = new Array();
if (location.search != "") {
vals = decodeURIComponent(location.search).split("=");
var selectedIds = vals[1].toString().split(',');

If you were using a JavaScript action the solution would be allot simpler. You could just define your JavaScript function to accept a parameter. This parameter will then be filled by your CrmParameter with the SelectedControlSelectedItemIds. No need to define a name here and you could also add multiple CrmParameters J

Tagged with: , ,
Posted in CRM 2011

Problem when configuring the E-Mail Router: allowed clock skew is ’00:05:00′.

We ran into this issue while configuring the CRM E-mail router with CRM 2011 Online.

After creating the deployment record and testing it with the Load data button, we received the following error:

The security timestamp is invalid because its creation time (‘2011-04-27T02:33:17.000Z’) is in the future. Current time is ‘2011-04027T02:28:00.1.172Z’ and allowed clock skew is ’00:05:00′.

It seems that the computer/server where the email router was installed was running more than 5 minutes behind the CRM server.

Changing the time on the client to match the time in CRM online seemed to solve the problem.

Tagged with: , ,
Posted in CRM 2011

Adding a custom tab with multiple groups to the CRM 2011 Ribbon

Ribbon design in CRM 2011 can be quite painful. It’s not documented that well in the SDK, and browsing through the ribbon XML is a real trivial task.

Recently I was trying to add a custom tab to the campaign entity in CRM. This tab should contain 3 groups which contained several buttons.
Following the guides posted here by Siva (http://dynamicscrm2011.wordpress.com/category/crm-2011-ribbon-customization/), I was able to do a great deal of the ribbon design. The only problem here was that he used only one group in the ribbon, which also worked for me.

As soon as I wanted to add a second and third group, no buttons were displayed for these groups.
It turned out that the reason for this was that I needed to define a MaxSize in the Tab node for each of these groups.

You will also need to do the same thing for the scaling of each group of course.

Check the “Define how Ribbon elements are re-sized based on the space available” part of the SDK for more info on this.


Command= MyCustomTab


Size=LargeMedium />

Size=LargeMedium />

Size=LargeMedium />

Size=LargeSmall />



Tagged with: ,
Posted in CRM 2011

Getting the Scribe CRM Adapter v4.4 to work with CRM 2011 Online

Last week we moved our existing CRM 4.0 database to the cloud! Was quite a struggle but we finally managed to succeed J

I wanted to use scribe to do the data migration, but it seems there are some issues with the 4.4 adapter for CRM.
It is supposed to work from CRM 2011, but you may experience problems when you are on the EU Servers of MS. (crm4.dynamics.com)

To get around this issue, add the following 2 registry keys under HKLM\SOFTWARE\Scribe\Adapters\DynamicsCRMAdapter

You should now be able to connect using the 4.4 adapter.
Make sure the authentication type is set to CRM Online (Live ID)

Tagged with:
Posted in CRM 2011

Importing Data in CRM 2011 using XML Spreadsheet 2003 format

Using the XML Spreadsheet format has a few advantages for importing data from Excel into CRM.

As opposed to CSV file imports you don’t have to specify any data delimiters anymore which depend on your regional settings.

Also, importing special characters seems to be more straight forward.

We recently had to import a large list of accounts and imported them first using the CSV format. A lot of the names display unreadable characters because something went wrong with the encoding from Excel to CSV.

After saving the original Excel as an XML Spreadsheet, the import of these special characters was no longer an issue.

So, make sure to save your import files as XML Spreadsheets! J

Tagged with: ,
Posted in CRM 2011
%d bloggers like this: