views:

1496

answers:

2

I am attempting to pass information from a task created within a workflow to its corresponding task form. Prior to the CreateTask activity, I create an SPWorkflowTaskProperties and fill it with the usual info (title, assigned-to, etc). I also add some elements to the ExtendedProperties property. However, those custom properties never make it into the Task.

I've tried setting the property key to:

  • the Guid of one of my task' content type's fields;
  • the internal name of one of my task' content type's fields;
  • an unrelated name (in the hopes of getting the info into the task's properties instead of its fields).

Nothing works. The task, once created, contains only the built-in field values I have set. None of values I explicitly added to the extended properties show up.

The (simplified) sequence of my activities is as follows:

  • PrepareTask. This is a custom activity that contains the SPWorkflowTaskProperties
  • CreateTask. The task properties are bound to the one in the PrepareTask activity.
  • OnTaskCreated. The task properties are bound to the one in the PrepareTask activity.
  • While (task not complete)
    • OnTaskChanged

I am using WSS 3.0 SP1 and an ASPX (NOT InfoPath) task form.

+1  A: 

I still don't know why my original solution didn't work. But I have found a workaround. My sequence of activities is now:

  • CreateTask
  • OnTaskCreated
  • CopyTaskItems. This is a custom activity that puts values into my custom task's fields, then updates the task.
  • While (task not complete)
    • OnTaskChanged

So I have to create the task, then immediately poke values into it and update.

I hope this will help some future reader of this question.

Paul Lalonde
A: 

You should be using a ItemMetadata.xml document as a secondary datasource that contains the definition of the fields that you want to pass to your task form. Something like:

<z:row xmlns:z="#RowsetSchema" 
    ows_Instructions="" 
    ows_Body=""
    ows_Comments=""
    ows_ApprovalStatus=""
/>

The File name is important btw.

Notice the ows_ (as it used the webservices all fields in the list will be prefixed with ows.)

Then in you infopath form, set the default value of each control you want to display this information in. Hit the fx button and insert a field or group from the secondary datasource.

A good resource: http://weblog.vb-tech.com/nick/archive/2007/02/25/2207.aspx