Context:
- Crafted a rather rich and extensive InfoPath ListForm for content type <X>
- Business requests similar but slightly different form for content type <Y>
Difficulties
- InfoPath Designer does not provide a native capability to duplicate an InfoPath form to another content type
- Drag-and-Drop from source InfoPath form template opened in InfoPath Designer to destination form template is limited, incomplete layout, no controls binding, ...
Pragmatic recipe for InfoPath Form copy
- Navigate to SharePoint List in a browser
- Go to 'List settings' \ 'Form Settings'
- Select content type <X>, the associated form opens in InfoPath Designer
- Save the template.xsn on a local location (or 'Save as' of the "source files")
- Return to 'List settings' \ 'Form Settings'
- Select content type <Y>, and select to create new form in InfoPath
- Immediate save as template.xsn on a local location, but make sure not to overwrite the one of <X>
- Navigate in Windows Explorer to the location(s) where you saved the .xsn files
- Rename the .xsn file-extension into .cab
- Extract both template.cab archives to local folders
- Open the folder of template for <Y>, and open template.xsf file in an editor. Lookup 'ContentTypeID' in the file, and copy the value
- Open the folder of template for <X>, and open template.xsf file in an editor. Lookup 'ContentTypeID' in the file, and paste the value copied from <Y>. Save the file.
- Make sure to reassign 'Open with' file association for template.xsf file to InfoPath Designer
- Double click the modified template.xsf file, and click 'Design' to open in InfoPath Designer
- Publish the InfoPath form to SharePoint List
Pragmatic recipe for partial InfoPath Form copy/reuse
- Step 1-10 as above
- Open the folder of template for <Y>, open in an editor the view.xsl for which you want to reuse layout from the form template of content type <X;>, and delete all content
- Open the folder of template for <X>, open in an editor the view.xsl that you want to reuse, select all file content for copy
- Paste the copied file content in the opened view.xsl of content type <Y>, and save the file
- Repeat this for every view in the form template that you want to duplicate/reuse
- Double click the modified template.xsf file, and click 'Design' to open in InfoPath Designer
- Publish the InfoPath form to SharePoint List
No comments:
Post a Comment