More About This Website

All information is provided "AS IS" with no warranties, and confers no rights

Login
Powered by Squarespace
« New CRM 4 Virtual Machine Available | Main | Workflow triggered by Update in error »
Tuesday
Mar102009

Could not find a Public, Static field with name 'xyz' of type DependencyProperty

When building custom workflow activities for CRM 4.0 pay attention to the names you give the dependency properties or you might just end up with this error.

Let’s look at a quick example of a dependency property

public static readonly DependencyProperty ResultProperty = DependencyProperty.Register
            ("Result", typeof(string), typeof(MyWorkflowType));

        [CrmOutput("Result")]
        public string  result
        {
            get
            {
                return (string)base.GetValue(ResultProperty);
            }
            set
            {
                base.SetValue(ResultProperty, value);
            }
        }

The part to pay attention to above is highlighted in red.  The code will compile fine but when you attempt to register it with CRM using the registration tool you will receive an exception.  The error will say “Could not find a Public, Static field with name “resultProperty” of type DependencyProperty.

Why’s this happen?  It appears that during registration MSCRM does a validation to ensure that you have a dependency property.  It expects the case of the name to be the same.  So in this case it wanted ResultProperty to be resultProperty with a lower case “r”.

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.