Wednesday, December 14, 2016

Publish an updated version of a form template

Publish an updated version of a form template

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

Help prevent data loss in existing user forms

Publish an updated form template

Let users choose whether to update their form templates

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.

Error message that warns form designers about potential data loss

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.

Top of Page

Publish an updated form template

Suppose that you plan to make changes to a form template that is already in use throughout your company. If those changes include changing the form template's underlying data source, you need a way to efficiently update the previously published version of the form template, to help ensure that all users are using the updated version. You can also specify what you want to happen to existing forms that are based on the original form template.

  1. Open the form template that you want to update.

  2. Make any necessary changes to the form template.

  3. On the Tools menu, click Form Options.

  4. In the Category list, click Versioning.

    At this point, you must specify what you want to happen to existing forms (.xml files) that were filled out by using the original form template.

  5. In the On version upgrade list, under Form template version, do one of the following:

    • To automatically convert outdated versions of the form to the updated version, click Automatically upgrade existing forms. When this option is selected, InfoPath won't prompt users to update existing forms. Rather, the update occurs automatically the next time they open an existing or new form.

    • To write custom code that handles the update process for users, click Use custom event, and then click the Edit button. You can then use the OnVersionUpgrade event, which occurs when the version number of an InfoPath form being opened is older than the version number of the form template on which it is based. For more information about the OnVersionUpgrade event, refer to the InfoPath developer documentation.

    • To prevent the forms from being updated, click Do nothing (existing forms might not work properly). 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.

  6. On the File menu, click Publish, and then follow the steps in the Publishing Wizard.

    When users open a form that is based on your form template, they automatically receive the new version of the form template. If they attempt to open forms that were created by using the earlier version of the form template, the changes that you specified in step 5 take effect.

Top of Page

Let users choose whether to update their form templates

When you publish an updated version of a form template, InfoPath replaces the copy of the form template that is stored on users' computers with the latest version. This happens automatically when users open a form that is based on the updated form template. In most circumstances, this is what you want to happen. However, it is also possible to display a dialog box that prompts users to update the form template when a new version becomes available.

  1. On the Tools menu, click Form Options.

  2. In the Category list, click Versioning.

  3. Under Form template version, select the Allow form users to choose whether to upgrade to a new version of the form template check box, and then click OK.

    Note: By default, the data for the registry value EnableAutoUpdatePrompt is 0 (off). Users are prompted to upgrade their form only if a system administrator has changed the data for the EnableAutoUpdatePrompt value from 0 (off) to 1 (on).

  4. On the File menu, click Publish, and then follow the steps in the Publishing Wizard.

The next time a user opens a form that is based on your form template, InfoPath displays a dialog box that prompts the user to replace his or her copy of the existing form template with the new version. The user can then decide whether to do so. If the dialog box does not appear, then the data for the value EnableAutoUpdatePrompt is probably 0 (off) instead of 1 (on).

Note: Before they actually open a form, users can proactively get the latest version of a particular form template (.xsn file) by clicking the Get update of this form or Get Updates of Forms in this Category link in the Fill Out a Form dialog box. Even if users already have the most recent version of the form template on their computers, the links remain active. In this scenario, when a user clicks one of the update links, InfoPath simply stores the latest form template on the user's computer again.

Top of Page

No comments:

Post a Comment