Beiträge getagged ‘Hints’

Why OptimizeOrgImport is not always an optimization

12 Juli 2010

Update Rollup 8 introduced an improved organization import process which speeds up the organization import.

You have to enable the optimized import process by adding the DWORD key OptimizeOrgImport with value 1 to the registry hive of Dynamics CRM (see the detailed description http://support.microsoft.com/kb/977867)

Recently, I had a problem during an import of an organization which failed with following error

Message: Exception during import of organization (Name=’‘, Id=3e58a0cc-c277-df11-b2c1-0050569473db):
System.Data.SqlClient.SqlException: A row with a duplicate key cannot be added to the object ‘dbo.SystemUserOrganizations’-object with unique index ‘SystemUserOrganizations_CrmUserId’

The organization which I tried to import was a backup of an organization which was created in the same deployment. The import runs successful on every other deployment. With help of the Microsoft Support, we identified the cause of the issue: the OptimizeOrgImport key.

The knowledgebase article for OptimizeOrgImport contains following passage:

When you use the registry entry OptimizeOrgImport and have the value of this entry set to 1, you cannot import the same organization database more than one time.
If you want to import the same organization database more than one time, you must do one of the following things:

  • Set OptimizeOrgImport = 0 and use the normal import process.
  • Delete the organization, and then import the organization again.

This passage is a little bit misleading, as the optimized import process fails already at the first time, if the organization was created in the same deployment. In order to import a backup of an organization into the originating deployment, you have to deactivate OptimizeOrgImport.

0×80044195 The specified language code is not valid for this organization

13 Dezember 2009

Recently I had a problem with a dev system at a customer site. The system was redeployed from the production site without any problems. Everything worked well, until I tried to customize the system. As soon as I tried to create new attributes or new relationships, the system produced an error

The language code 1033 is not a valid language for this organization

I searched the net, but the only things I found was that this error is listed as an error code of Dynamics CRM (see http://msdn.microsoft.com/en-us/library/bb930493(loband).aspx) and a thread in the Dynamics Forums (http://social.microsoft.com/Forums/en/crm/thread/70bbbf36-1ecb-443e-852a-bebaa70c7206), but sadly without a solution.

After contacting the Dynamics CRM support team, the cause of this error was found in a matter of minutes. The system was redeployed from an installation with German base language to a system with English base language. This is an unsupported scenario.

Neither there was a warning at the redeployment wizard, nor is this mentioned in the Implementation Guide (at least, I haven’t found it there). The support engineer provided me following excerpt there this scenario is described as unsupported

The original deployment and the new deployment of Microsoft Dynamics CRM must be the same base language.

NOTE: Redeployment between different base languages, for example from English to French, is not supported.

To bad that this snippet is only included in the course material for the Installation and Deployment exam and not in the Implementation Guide. The only solution was to do a full reinstall of Dynamics CRM with the same base language as the originating system and to do the reployment again.

Update
In the meantime I got new feedback from the support engineer (thank you José) who is responsible for my case. Microsoft will document this scenario either with a knowledgebase article or by adding the quoted note to the Implementation Guide.

System.InvalidOperationException at crm logon

17 November 2009

Today I had a service call with Microsoft CRM Support. After the import of an organization into a development system at a client, it stopped working. Trying to logon CRM via web client fails with error message:

System.InvalidOperationException: ExecuteNonQuery requires the command to have a transaction when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized.

The solution of this problem was quite simple (after the reason was found). The application pool of the system had insufficient rights for the organization database.

To get the system up and running again you have to

  1. Identify the identity of the application pool
  2. Ensure the app pool idenity has a sql user assigned for the organization database
  3. Grant the app pool identity the right db_owner on the organization database
  4. Restart IIS

Who triggered my plugin?

12 September 2009

Do you ever want to know who triggered the execution of a plugin? This knowledge is handy, if you have to do some operation if the user entered data, but not if an external application made an update with the SDK.

The IPluginExecutionContext contains the property CallerOrigin which will tell us more about the origin which triggered the plugin execution.

The CallerOrigin is populated with one of these four types

  • Application – The user has triggered the event (by creating or editing a record).
  • AsyncService – The async service triggered the event (by workflow execution).
  • WebServiceApi – An application which makes use of the crm web service triggered the event.
  • OfflineOrigin – The event was triggered by replaying offline actions while going online.

This sample shows how to make use of this property (the sample is part of the sdk article Online vs. Offline Plug-ins)

using System;
using Microsoft.Crm.Sdk;
using Microsoft.Crm.SdkTypeProxy;
 
public class OnlinePlugin : IPlugin
{
   public void Execute(IPluginExecutionContext context)
   {
      // Check to see if this is a playback context.
      CallerOrigin callerOrigin = context.CallerOrigin;
 
      if (callerOrigin is OfflineOrigin)
      {
         // This plug-in was fired from the playback queue after the user
         // selected to go online within Microsoft Dynamics CRM for Outlook.
         return;
      }
      else
      {
         // Do something here.
      }
   }
}