Friday, August 19, 2011

The CRM 2011 SDK is wrong (ish)

So that might be a slight exaggeration, but I just hate it when documentation is incorrect. In this situation, the culprit is the javascript to assign a value to a lookup field. According to the SDK, there are 3 properties you must set on your array to set the value on a lookup:
  • id
  • name
  • entityType
Unfortunately, if you try to set these three properties and then use the setValue() method to assign it to a lookup, you will either get nothing or an error stating that the "object does not support this property or method". That's because "entityType" doesn't actually exist.

Instead, you must create your array, same as before, but set the id, name, and type. Just "type". Set this to the object type code for the entity (1 for account, 2 for contact, 8 for user, etc.) and suddenly the setValue() actually sets something.

EDITED TO ADD:
So it seems I am only half correct. Upon reading the SDK more closely, it seems you CAN set entityType, but it should be a string for the entity instead of the type code. Got so used to the type codes in 4.0.... Anyway, if you set entityType to something like "account" or "systemuser" then it works.

Tuesday, February 15, 2011

CRM 2011 Outlook client x64

One of the great new features with CRM 2011 is support for 64-bit environments. With CRM 4.0, the Outlook client was x86 only, meaning that you had to install 32-bit Office (regardless of your operating system being x86 or x64) in order to install the CRM Outlook client. With CRM 2011, now x64 Office is supported, which is fantastic.

Except that the installation doesn't work. Well, it works, but you can't connect to an organization. Here is what I discovered, and how I fixed it.

  1. The installation of the client runs just fine. The new installer is like other Office 2010 installs - you get a big button for "Install Now" and then another smaller one if you want options, which are essentially where to install and do you want to enable Offline access. No problems so far.
  2. I ran the configuration wizard, selected CRM Online to connect to my organization, and entered my Live ID information. The wizard found all of the Online organizations my Live ID is associated with, and I picked the one I wanted and clicked OK.
  3. The wizard did some initialization tasks, sat for a while, and then failed with an error: "There is a problem communicating with the Microsoft Dynamics CRM server. The server might be unavailable. Try again later. If the problem persists, contact your system administrator".
  4. Since that error isn't terribly helpful, I did more research. In the log (which is buried in Windows 7 under C:\Users\user\AppData\Local\Microsoft\MSCRM\Logs\Crm50ClientConfig.txt), I found this error:
    Exception : Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8082. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details

  5. Naturally, I checked out that article. The KB states that you might get this error if, on a 64-bit computer, you haven't installed BOTH the x86 and x64 versions of SQL Compact 3.5. Upon examination, this was true - the CRM client installation had only installed the 32-bit version. Fortunately, the KB article contained a link to the installers for SQL Compact 3.5 SP2.
  6. I installed the x64 version, and retried the configuration wizard. Still no dice, and the same error in the log. I revisited the KB article and noticed that you can get this error if the versions don't match between x86 and x64. SP2 is the most recent, BUT looking under Programs and Features, the x86 version installed by CRM is 3.5.8082.0 and stock SP2, which I had installed for x64, is 3.5.8080.0.
  7. Searching for the version number, I discovered a hotfix for SQL Compact 3.5 SP2 which brings it up to .8082. Downloaded and installed the hotfix to get both versions to the exact same release. (I also tried downgrading the x86 version to .8080 and got the same ADO error in the log.)
  8. Re-ran the configuration wizard, and after one stumble with actual network problems, it finally connected and works!

Long story shortened:
  • The x64 installer for the CRM 2011 Outlook client does not include everything necessary for the client to work.
  • You must download the x64 installer for SQL Compact 3.5.
  • You must upgrade the x64 version of SQL Compact 3.5 to version 3.5.8082.0 with the hotfix.
  • At this point the Outlook client should be able to connect to your CRM 2011 organization.