In my previous blog post, I described what I wanted to do and some configuration steps.
Now I am ready to create the workflow that will migrate content. I create the workflow in the document library containing the InfoPath documents.
I select a blank workflow template and click Create.
Next I create workflow variables for each field.
The workflow variables appear below. I use the letter “t” in front of each field name.
Note that the last variable is new and named tProjectID. It is a List Item ID type.
I click Close to close the Workflow Variables screen.
Next I select the Workflow Action named Query XML in Integration.
This is the first action in the workflow.
I configure the workflow action. 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:ProjectName.
Then click on Apply.
The Query XML screen is displayed and I select Store result in tProjectName. tProjectName is one of the workflow variables that I created earlier.
I click on and repeat the process for the remaining form fields on the main Project form.
Now we need to save the values to a new list item. Select Create item from Libraries and lists.
Create the item in the Project Main custom list. Set the content type to Item. Store the new item ID in tProjectID. I will reference the value in tProjectID later when I create the Task Detail items. Then add all of the main fields as seen below. You have to pick them one by one from the Field drop down list.
Note that I set the return type for tProjectOwner and tDescription to be Plain Text.
Click Save to save the Create item action configuration.
We need to save the ID value to the Project ID field in the new list item. Select Update item from Libraries and lists.
I want to update the new item that I just created in the Project Main custom list. I select Project Main from the Update drop down list. I select ID in the Where drop down list. I set Equals to Workflow Data and the tProject ID. It seems silly; but I am looking up the item that I just created using the Project ID value that I stored in the Workflow variables.
Next I set the Project ID on the new item to be equal to the tProjectID value stored in the Workflow variable.
I believe that the reason why I have to do this is because the ID value is not initialized and saved to the Workflow variable named tProjectID until the new item is saved. Thus, I need to go back a second time to the item to save the item’s ID value to the Project ID field.
I save the Update item configuration.
Click Save to save the Query XML configuration. Set the Title and Description (optional).
Click OK. The workflow is saved.
Next I need to add the Project details to the workflow. See my next blog posting for the details on how to do this.