locked
Cannot pass data to .aspx task form using SPWorkflowProperties.ExtendedProperties RRS feed

  • Question

  • I've tried all manner of syntax and object combinations to try and pass information form one task to the next in a StateMachineWorkflow.

    Could some-one please explain how I do this.

    I have a task form  (custom content type with *.aspx form) that has a text box for the user to add their comment before clicking 'Accept' or 'Reject'.
    I want to take that users comment and include it as asp:label.text on the next task form ( another custom content type with another *.aspx form). In my mind this should be easy?! But I just cannot retrieve the comment!!

    Please help.

    TIA
    MartyNZ
    Tuesday, October 20, 2009 1:37 AM

Answers

  • Try SPWorkflowTask.GetExtendedPropertiesAsHashtable(taskItem)

    Dennis Alzoubi
    • Proposed as answer by Dennis Alzoubi Monday, October 26, 2009 2:50 PM
    • Unproposed as answer by Martyn_NZ Tuesday, October 27, 2009 7:36 PM
    • Edited by Dennis Alzoubi Tuesday, October 27, 2009 7:58 PM changed Item to Task
    • Proposed as answer by Dennis Alzoubi Thursday, November 5, 2009 3:40 PM
    • Marked as answer by Martyn_NZ Thursday, May 19, 2011 8:09 PM
    Wednesday, October 21, 2009 4:08 AM

All replies

  • Marty,
    If you are trying to pass the comments from one task to the other in your workflow, ther are two ways to do this:
    1. Let the workflow manage that for you by accessing the TaskAfterProperty on the task change and getting the Comments from the first task and pass them as an extended property to the second one.
    2. Access the SPListItem.Properties["Comments"] or whatever you called it in your extended properties.
    Now, one thing to keep in mind is making sure you actually store the value from the first task form in the task properties, otherwise neither will work since the value is lost!
    To do so you need to create a HashTable that will hold all the extended properties that need to stay with the task and then followed by

    SPWorkflowTask.AlterTask(<yourListItem>, <taskHash>, true); more details, click here

    Hope this helps.
    Dennis Alzoubi
    Tuesday, October 20, 2009 7:46 PM
  • Hi Dennis,
    thanks for the response, but it's not the passing data into the HashTable that's the problem. It's reading it from the HashTable. >:(
    I have tried SPListItem.Properties["MyProperty"] and many other varaiations and always end up with a NullReferenceException error, "Object reference not set to an instance of an object."

    any ideas?

    Cheers
    Martyn
    Tuesday, October 20, 2009 11:42 PM
  • Further, on the same issue, I have a field in the custom content type of the list this workflow is working on that I would like to pass the contents of into the first task form. Basically the same issue as above but trying to access the contents of a list field.

    cheers
    Martyn
    Tuesday, October 20, 2009 11:46 PM
  • Try SPWorkflowTask.GetExtendedPropertiesAsHashtable(taskItem)

    Dennis Alzoubi
    • Proposed as answer by Dennis Alzoubi Monday, October 26, 2009 2:50 PM
    • Unproposed as answer by Martyn_NZ Tuesday, October 27, 2009 7:36 PM
    • Edited by Dennis Alzoubi Tuesday, October 27, 2009 7:58 PM changed Item to Task
    • Proposed as answer by Dennis Alzoubi Thursday, November 5, 2009 3:40 PM
    • Marked as answer by Martyn_NZ Thursday, May 19, 2011 8:09 PM
    Wednesday, October 21, 2009 4:08 AM
  • Sorry Dennis but I can't find any reference to SPWorkflowItem!?

    cheers
    Martyn
    Tuesday, October 27, 2009 7:37 PM