Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I've created a custom approval worfkflow for an listitem. Now I need to see the values of the item in the taskitem. So I think one way would be to attach the ListItem to the TaskItem.

Does anybody know how do solve this problem? Or does anybody has a better idea?

My Idea:

Taskitem.Attachments.Add(ListItem)

But Taskitem.Attachments.Add needs a byte[] as parameter.

share|improve this question
add comment

2 Answers

Can you create a custom task contentType and add a link field in your custom task content type and populate the link that directs back to your original Item instead of creating 2 copies of the same item.

share|improve this answer
add comment

I'd do it all from the code, by adding a variable (property) to ExtendedProperties.

  • In case task is being created (CreateTask activity) and variable has not been defined yet:

    TaskProperties.ExtendedProperties.Add["List_Item_URL", workfloProperties.Item.Url.toString()];

  • In case task is being modified after task was created (e.g. using onTaskChanged) and:

    • If variable has not been defined yet:

    AfterTaskProperties.ExtendedProperties.Add["List_Item_URL", workfloProperties.Item.Url.toString()];

    • If variable has previously been defined (e.g. during creation of the task):

    AfterTaskProperties.ExtendedProperties["List_Item_URL"] = workfloProperties.Item.Url.toString();

As you understand, "List_Item_URL" is just example, you could add as many variables as needed this way. Not only with URL to listItem, but with any other data of listItem that taskItem might need to have in it.

After that it would be important to make sure task form displays those variables you added, the way you want. In case it is custom InfoPath form, you'd import it through ItemMetadata.xml with all fields listed as ows_fieldName and so on, but this is part of another story. Here is a good article on this: http://blogs.msdn.com/b/ncdevguy/archive/2009/10/31/infopath-retrieve-and-send-data-from-to-a-sharepoint-2007-workflow.aspx.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.