How to create initiation form for SharePoint2010 workflow part2
In the last post, I have shown you how to create Asp.net initiation form. In this post I will show you how to create the same initiation form using InfoPath. You can download the complete solution here.
1. Create an empty form using InfoPath2010
2. Add the a label, textbox and a button to the form
3. Add the following rules to the Start workflow button.
a. Add a Submit data action
b. click the add button and add a new connection
c. Choose the “To the hosting environment, such as an ASP.NET page or a hosting application.
d. Click OK to add the submit data connection.
e. Add the close form action and you are done with the rules.
4. Publish the form to the network and deploy the form to the SharePoint. You can find the details instructions in my previous blog.
5. You need export the InfoPath form and generate the code to get the data from the form.
a.Go to File >> Publish >> Export Source Files
b. Open visual studio Command prompt
c. Run the following command to generate the code:
xsd mychema.xsd /c /l:cs
6.Add the myfields.cs to the project under workflow node.
7. Modify the elemets.xml file in your custom workflow, as below.
8. You can get the FormURN by going to File >> Form Info >> Form template properties and the ID field is the current form URN.
9. Now, go to your workflow designer and bind your History description to a new property.
10.In the workflow activated event handler , write the following code.
11. Deploy your solution and invoke the workflow and you will see the InfoPath form Initiation Form