Quite often you run into situations, where you have InfoPath forms in several variations. For example a form with red colored design for critical issues, a yellow one for normal issues, and a green one for absolutely not critical issues. Each of these content types has different fields, but all of them share the same fundamental columns.
To use multiple lists should not be considered to be the correct solution, it would be better to use a single form library and group by content types. Here comes the big drawback: using the same fundamental columns is not easy when using the publishing feature of InfoPath and you probably will run into issues like values of published columns not appearing or multiple columns are created for each content type.
A good start is to create the xml data structure of the forms first, before designing the forms. This helps you to find out about the shared columns. This is important, because you have to know the shared columns before you publish them the first time to the form library.
After developing the xml schemas for the forms and finding out about the shared columns, let’s move to the SharePoint Server 2007 to create what we need. A blank form library is a good starting point. There are several options; here I will describe the one that is in my opinion the cleanest and most appropriate way of doing it.
Create site columns on the site that contains your new form library. I have experienced, that using new groups for the site columns that are named accordingly to your project is a big DO, while using blanks in the names of the site columns is a absolute DON’T. This is because when you are writing XSLT queries or if you are programming C# or VB code for your InfoPath forms and query the lists fields, the blanks will be converted to “%5Fx0020%5F” resulting for example in the field name “This%5Fx0020%5Fis%5Fx0020%5Fa%5Fx0020%5FTest” so not a very desirable name for a variable.
If you finished this first step you are almost done. Just select the site columns in the publishing wizard of InfoPath and all of your forms will publish their data to the same columns, no additional ones will be created and the values will appear correctly when the forms are submitted to the list. At the end, just group the form library entries view by content type or create views that filter by content type to enhance the user experience. It’s really that easy…
Thanks to maikl for this great entry!