andrew.beals@nintex.com

Provision a Nintex Workflow that contains an Infopath form programmatically

Blog Post created by andrew.beals@nintex.com Support on Jan 22, 2017

Why doesn't my InfoPath form export with my Workflow?

 

From time to time we get the question why a Nintex Workflow that contains an Infopath form wont copy the InfoPath form along with the workflow when the workflow is exported. This makes deploying and/or migrating the workflow that contains an InfoPath form a pain point for administrators. The reason for this is due to the InfoPath form being stored in SharePoint content and not inside the workflow .xoml. Therefore when you export the workflow the Infopath form does not get exported along with the workflow. This behavior occurs in both Nintex Workflows and SharePoint Designer workflows.

 

Where are these Forms located in SharePoint?

The InfoPath from is located in two locations in SharePoint both of which you can navigate to using SharePoint Designer.

 

Location #1 The hidden 'NintexWorkflows' Library:

The .xsn file located here is used in the Nintex Workflow Designer to render your form for editing and saving if you do not wish to publish the form immediately.

 

----------------------------------------------------------------------------------------------------------------------------

 

Location #2 The hidden 'Workflows' Library:

The .xsn file located here is what SharePoint uses to render the form when you view the task in SharePoint. The form needs to be here so SharePoint will know where to locate the form when executing the workflow. The form is required to be here due to the the 'ows_FormURN' property in the XML of the workflow task item that is associated with the workflow task. This property is what SharePoint uses to find the .xsn file to load the form on the WrkTaskIP.aspx page. Below is an example of the 'ows_FormURN' property in a workflow task that contains a InfoPath Form:

 

 

Publish the workflow to the new location using Powershell.

 

Now that we know where the InfoPath form is located and how SharePoint loads the form on the WrkTaskIP.aspx page we can download copies of this form using SharePoint Designer. Once you have the export of the workflow, the export of the .xsn from the 'NintexWorkflows' library and the export of the .xsn from the 'Workflows' library you can use Powershell to publish the workflow and copy the .xsn files to their correct locations.

 

You can find a Powershell script I have written to accomplish this attached below. Let me know if you have any issues with the script or if this has helped you out in some way. Who doesn't love a little positive feedback?!

 

Cheers,

Andrew Beals

Outcomes