Tuesday, August 12, 2008

TaskProperties Null in CreateTask activitiy

In a statemachine workflow I was building recently, I made the mistake of assigning my TaskProperties in a CreateTask activity to a new Property instead of a new Field (Bind to a new Member tab). Fields get initialized as SPWorkflowProperties objects with all the properties such as Title and AssignedTo instantiated and ready for you to assign values to them in your invoked event. This is not the case with Properties, the Title and AssignedTo sub props won't be accessible because the prop isn't setup as a strongly typed SPWorkflowProperties object yet. Instead, you get "Object reference not set to an instance of an object" when you try to access title or any other sub props. There you go.

No comments: