3

I am using a SharePoint Designer 2010 custom approval workflow. I capture an initiation form parameter and save that value into a field in the list item associated with the workflow.

I need to display this value on the task edit form. I created a task form field, but I cannot find a way to set it from the workflow variable or the list item.

3 Answers 3

1

Task Item have a WorkflowItemId field. You can add list as datasource to infopath and find element by Id.

1
  • I added a secondary datasource for the SharePoint list on which I am running the workflow, but I do not see any field in that list to connect to the workflow. Also, I don't see a WorkflowItemId field for the task item; I'm looking at the Main data connection on my task edit form.
    – Laurie
    Apr 15, 2011 at 22:08
1

Edit the Approval workflow

  1. Add a Task Form Field.
  2. Change the behavior of a single task.
  3. In Step(Before a Task is Assigned), add action: Set Task Field, assign to the Task Form Field the Initiation Form parameter.
  4. In InfoPath, add the Task Form field to the Task Edit form (it is available in the Main data connection)
1

I ended up solving it this way:

  1. Added a column to the Tasks list

  2. Created a secondary workflow on the Tasks list to populate this new column. This is done with the "Update List Item" action and doing a lookup to my doc library, matching the ID to the Workflow Item ID.

  3. In InfoPath, added a new data connection to the Tasks list to get my new column.

  4. Added the field from the Tasks list onto my InfoPath form and added a rule to hide the control if the ID <> Main Connection.ID

  5. Then, I would get this error intermittently: "this task is currently locked by another running workflow and cannot be edited". To fix it I added a column to my doc library for a flag, which I set while the secondary workflow was updating the task. Then I had the primary workflow wait for that flag, before continuing.

2
  • I started merging your answers and then realised they were different. I'm a little confused as this is the answer that solved your problem, but you have marked the other answer with a tick. Could you please clarify?
    – Alex Angas
    May 11, 2011 at 2:56
  • My original solution sort-of worked, but having a second workflow caused errors when I had multiple approvers. The accepted answer is the better solution - it is simpler and works every time.
    – Laurie
    May 11, 2011 at 3:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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