tags:

views:

86

answers:

2

When you register a plug-in in Microsoft CRM all kinds of things can go wrong. Most commonly, the error I get is "An error occurred."

When you look for more detail you just get: "Server was unable to process request" and under detail you see "An unexpected error occurred."

Not very helpful. However, there are some good answers out there if you really dig. Anybody out there encountered this and how do you fix it?

+1  A: 

The most common issue is that the meta parameter names must match.

For example:

public static DependencyProperty householdProperty = DependencyProperty.Register("household", typeof(Microsoft.Crm.Sdk.Lookup), typeof(AssignHouseholds));

  [CrmInput("AccountId")]
  [CrmReferenceTarget("account")]
  public Microsoft.Crm.Sdk.Lookup household
  {
   get
   {
    return (Microsoft.Crm.Sdk.Lookup)base.GetValue(accountidProperty);
   }
   set
   {
    base.SetValue(accountidProperty, value);
   }
  }

Note the name after DependencyProperty (housedProperty) must exactly match the string after DependencyProperty.Register (in this case ("household") with the word "Property" appended.

Also, that value must match the value of public variabletype (in this case "household"). If any one of them don't match, it will error.

This is by design and is how MSCRM ties the values together.

Jeff Davis
+1  A: 

A common cause is that your CRM SDK references must use the 64 bit version if you are on a 64 bit machine.

These will be located at C:\sdk\bin\64bit\microsoft.crm.sdk.dll and C:\sdk\bin\64bit\microsoft.crm.sdktypeproxy.dll if you installed the sdk to C:\sdk.

Also your build settings should be set to "Any CPU" under Project properties->Build.

You may also need to move the two dlls to your debug or release folder before you build.

Jeff Davis