Monday, June 15, 2009

Prepare your InfoPath for deployment and be sure your form is generic

When creating an InfoPath form, we often use the data connections.
InfoPath makes it easy to work with data connections, but the issue is that the links to the SharePoint library or database is saved in the InfoPath Form.

What if we have to move the SharePoint Library to another place?
Ex. Test -> Production Environment

What if we change the name of the SharePoint Library we want to submit too?

We can’t always return to our InfoPath Designer, make the changes and publish again.

Happily for us, InfoPath 2007 with SharePoint has a solution.  SharePoint offers a Data Connection Library.
Within the data library we place our InfoPath Data Connections.  When changing database password, changing SharePoint Library names or paths etc we just change the Data Connection file in the Data Connection Library and your InfoPath will continue working.

The next part will explain you step by step how to do this.

To Create a SharePoint Data Connection Library if the library does not yet exists.

1. Browse to an Office SharePoint Server 2007 or Office Forms Server 2007 site on which you have at least Design rights. If you are on the root site, or portal, go to the Document Center or create a new site before proceeding to the next step.

2. Click Create on the Site Actions menu.

3. On the Create page, click the Data Connection Library link in the Libraries section.

4. On the New page, type a name for the library and click the Create button.

5. Copy the URL of the new library.

Update your InfoPath file

1. Create a data connection in InfoPath, following the wizard

2. After creating the data connection, you see the list of data connection.

Select the newly created data connection

3. Click on Convert

4. On the Convert Data Connection dialog box, enter the URL of the data connection library that you previously copied.

5. Delete "Forms/AllItems.aspx" in the URL.

6. Enter a name for the data connection file at the end.

7. Click OK.

8. Confirm that the data connection has been converted successfully by examining the Details section of the Data Connections dialog box while the converted data connection is selected.

Don’t forget to publish your InfoPath Form.

You will see that under the Data Connections Library, a new file is added.  This file needs to be updated when moving environments, changing databases, changing submit libraries etc.

No comments: