Have you ever wanted to have an InfoPath form generated by a workflow? Well I thought it would be a simple task but I had to do some extra things to make it happen correctly.
I recently wanted to be able to generate an InfoPath form based on an event on a SharePoint Designer workflow. So I published my InfoPath form to a Form Library, added an action to create a list item and then ran the workflow. I believed this would work because I have created Word templates, associated them to content types and the word file would be created just fine with the appropriate template. The net result in this situation does not work. Instead the InfoPath form template (.xsn file) is created as a file instance. The InfoPath xml that I had expected was not there.
Solution
I found this article (http://www.bizsupportonline.net/blog/2009/06/create-infopath-forms-sharepoint-designer-workflow/) which I reviewed. My solution is a little bit different because I was building this solution in SharePoint Online in Office365 and I was not able to implement this exact solution. However I was given some clues and came up with the following.
My solution was to:
- Publish the InfoPath form the same way I did before.
- Then I created an instance of the InfoPath form xml and saved it to my desktop.
- Then went to the form library configuration, advanced settings and turned on “Allow management of content types”.
- Then clicked on the default Form Content Type.
- Then clicked on Advanced Settings for the Form Content.
- Then I selected Upload a new document template and selected xml template I saved locally.
The InfoPath form template (.xsn file) is still there behind the scenes and the form will render correctly through InfoPath form services.
There are a few limitations of this solution:
- The user will not be able to create a new InfoPath form instance through the browser using the New Document button in the ribbon. What will happen is the InfoPath client will launched. This is not such a big deal because in my situation InfoPath forms will always be created through the workflow.
- If the InfoPath form changes, you will have to publish the InfoPath form template (.xsn file) and then go through these steps again.