In my previous blog post, I create the workflow to migrate the Project information from the main part of the form to a custom list. Now I repeat the process for the task details. If you recall, the task details are in a repeating section on the InfoPath form.
I create workflow variables for each field. This time each variable is create as a Collection Type. Then I repeat and create each variable as the correct data type; but with the letter “t” in front of the field name.
Finally, I add a workflow variable named TaskIndex and give it a Number type.
I close the Workflow Variables screen.
Next I select the Workflow Action named Query XML in Integration.
The XML source should remain set to the Current Item. Process using XPath.
Click on XPath Builder.
I copy and paste the XML that I displayed earlier.
Then I click on Tree View and select /my:myFields/my:group1/my:group2/my:TaskName.
Then select colTaskName in Store result in.
Add the next two task fields.
The text in each of the three repeating task fields will be saved in the collection variables.
Next, we need to loop through the values in the collection variables and store them in separate task detail items.
Add a For Each loop action below the second Query XML action.
Configure the For Each loop action so that the text in the task name collection is saved to the single task name. The target collection is the colTaskName. colTaskName contains the task names. Store the result in tTaskName. Use TaskIndex as the Index.
I need to repeat this for Task Description and Task Owner. I add a Run parallel actions workflow action below the For each loop action.
The action should appear below the For each action. Two branch actions appear.
Next, I create a Collection operation below each Branch action in the Run parallel actions. You can add more branches and collections for each field / variable that you have in your repeating section.
I added two collection operations.
Next, I configure the first collection operation for Task Details.
Then I configure the second collection operation for Task Owner.
Next I save the Task Detail values for each of the task details in the repeating section of the InfoPath document. I add a Create Item action below the Run parallel action.
Configure the action to create the item in the Project Details custom list. Set the content type to Item. Add all of the detail fields as seen below. You have to pick them one by one from the Field drop down list.
Note that I add the ProjectID column and give it the value from the tProjectID variable. I also added the Project Name to the Title field.
Note that I set the return type for tTaskDetails and tTaskOwner to be Plain Text.
I enable the workflow to start from the item menu. I set this in Workflow Settings.
Then I save and publish the workflow.
Here is a view of the completed workflow.
I close the workflow and return to the document library.
I select a document and click on the ellipsis.
I click on the next ellipsis, and click on the Project workflow.
I am taken to the Start Workflow screen.
I click Start.
The main Project document field values are saved to the Project Main list.
The task detail fields of the Project document are saved as individual documents to the Project Details list.
Next I need to transform the InfoPath form into a Nintex form. Then update the form to work with the main and detail lists. See my next blog posting for the details on how to do this.
2 thoughts on “Add the Details to the Workflow – 3 of 4”