Introduction to updating existing form templates
When you publish a form template that you have changed, InfoPath can update both the form template (.xsn file) and any existing forms (.xml files) that are based on that form template. By default, InfoPath automatically replaces the older version of the form template with the latest version. You can choose the update method that you prefer for existing user forms.
In this article
How InfoPath updates form templates
When users first open a form that is based on your form template, the underlying form template file is stored in a temporary location on their computers. This temporary location is called a cache. Among other things, the cached location allows users who are offline to be able to work with a local copy of the form template.
InfoPath updates the cached version of a form template whenever a new version becomes available. This update happens automatically whenever users open a new version of the form. If users happen to be working offline when you publish an updated form template, the update occurs the next time that they connect to the network.
Users typically won't notice that an update is occurring, although you can specify otherwise when you design your form template.
Note A custom installed form template is a form template that is installed on users' computers by means of a Microsoft Windows Installer (MSI) package or other Setup program. With this type of form template, you must manually reinstall the form template on users' computers each time you update it. The installation may happen automatically, through a program such as Microsoft Systems Management Server (SMS) 2003, through a desktop-to-desktop deployment, or through some kind of installation script.
Considerations for updating browser-enabled form templates
All browser-enabled form templates are hosted on a server that is running InfoPath Forms Services, which is a server technology built on Windows SharePoint Services 3.0. There are two deployment modes for hosting form templates on a server running InfoPath Forms Services: one for end-user deployment and one for administrative deployment. When you update a browser-enabled form template, consider the following:
If you plan to update an administrator-approved form template, you must publish the updated form template, and then give it to your Windows SharePoint Services 3.0 farm administrator for deployment to a form library in a site collection. A site collection is a set of Web sites on a virtual server that have the same owner and share administration settings. When a farm administrator deploys an updated form template, he or she can specify a "side-by-side" upgrade option, which allows the updated version of the form to run alongside the original version. This upgrade option allows users who are in the middle of filling out a form when an updated version is deployed to finish filling out the form without losing their work.
If you publish updates to a form template that you have deployed yourself to a Windows SharePoint Services 3.0 library or list, users who happen to be in the middle of filling out a form that is based on that form template will see an error message when they attempt to save or submit their form. For this reason, you may want to alert users of impending updates and possibly take the form template offline during off-peak hours to perform the updates.
Help prevent data loss in existing user forms
If you need to update an existing form template, you can change it, republish it, and redistribute it to users. However, certain types of changes may prevent you from accessing the data in the completed forms that were based on the original form template.
If you make a change to a form template that may result in data loss or errors in forms that have been filled out already, a message will appear. You will often see the message when you add new, required fields to a form template, or when you rename or remove fields or groups from the form template.
When you receive this message, if you click Yes and continue with your changes, it may not be possible to access the data in existing forms after you publish the updated form template. In some scenarios, this may be acceptable. You will have to decide what works for your situation.
To help ensure that you can access the data that you already collected from users, follow these guidelines when you make changes to your original form template:
Don't rename the existing fields and groups in the data source.
Don't move the existing fields and groups around in the data source.
Don't delete the existing fields and groups from the data source. You can delete controls from the form template without causing any problems, as long as you leave the control's corresponding field or group in the data source.
Options for updating existing user forms
When you make changes to an existing form template, the existing forms (.xml files) that are based on that form template may need to be updated so that they work with the latest version of the form template. This helps ensure that users can continue to work with their existing forms without any problems, and that you can continue to access any data that is collected in those forms. When you update your existing forms for users, there are three methods you can choose from:
Update the forms automatically You can let InfoPath automatically update the existing forms, which is the default setting. In this case, any existing forms will match the newly updated form template. For example, if you remove a list box control on the form template and then publish the modified form template, InfoPath will automatically remove the list box control from any existing forms.
Update the forms by using code Those with technical expertise can write code to handle the OnVersionUpgrade event, which occurs when the version number of the form being opened is older than the version number of the form template on which it is based. For example, in an expense report form, you can use the OnVersionUpgrade event handler to determine whether a form with an earlier version number contains a field called emailAddress and, if not, add the field to the form. The OnVersionUpgrade event is useful for accommodating changes to the XML Schema upon which your form template is based.
Choose not to update the forms You can choose not to update the existing forms. When this option is selected, users are able to fill out forms based on the updated form template, but they may not be able to open existing forms. If they are able to open existing forms, they won't be able to edit any newly added fields.