· WSS3.0
· MOSS2007
· Office InfoPath 2007
· SQL server with Adventure Works database
· Administrator rights for MOSS server
In moss, we often use InfoPath form and work flow to deal with a business flow, and nearly every InfoPath form will contains one or many data connections. Generally, these data connections will be published as a part of form (XSN). Bu t what should we do when we want to change data connection? A general scenario, when we transform our APP from development environment to production. And this article will show us a solution for this question.
Ø Open Office InfoPath 2007.
Ø Choose “Design a Form” -> “Design a Form Template”, select “Blank”.
Ø Insert a table with two columns and one row.
Ø In the first cell, type “Browse Products’ Name ”.
Ø Select “Controls” from “Design task” panel, and drag a dropdown list control to second cell.
Ø Back to “Design Task” panel, select “Data Source”, in “Data Source” panel, select “Manage Data Connection” link.
Ø From “Data Connection” form, click “Add” button.
Ø In “Data Connection Wizard”, select “Create a new connection to:”->”Receive Data”, click “Next”.
Ø Select “Database (Microsoft SQL Server only)”, and “Next”.
Ø Click “Select Database”.
Ø In “Select Data Source” form, click “New Data Source”.
Ø From new window, select “Microsoft SQL Server”.
Ø Type your server name or”.” And “Next”.
Ø Select “AdventureWorks” database, and select “Product” table, then “Next”.
Ø Click “Finish”.
Ø Back to wizard, click “Next”.
Ø Click “Next”-> “Finish”.
Ø In “Data Connections” window, select “Product” and click “Convert” button.
Ø Type “Your Data Connection library/product.udcx”(Mine is http://mdtit-xiangfei/ArthurReport/Data%20Connections/product.udcx ), select “Centrally managed connection library(Advanced)” and “OK”.
Ø Click “Close”.
Ø Double click “DropDown list”. Select “Look up values from an external data sources”.
Ø Select “Product” for Data Source.
Ø Add “Name” for entries and click “OK”.
Ø In order to use this Form in workflow, go to”Tools->Form Options->Security and Trust”, select second “Domain”, click “OK”. More information is in http://blah.winsmarts.com/2007-8-Workflow_+_InfoPath_Forms,_Form_is_not_workflow_enabled.aspx.
Ø Save form.
Ø Publish form, select the first “SharePoint Server”, and “Next”.
Ø Type your server link. Mine is http://mdtit-xiangfei/.
Ø Select “Enable this form to be filled out by using a browser”.
Ø Select a location to store you published form, I store it in desktop.
Ø Go to Data Connection library, select “Product->Send To-> Download a copy”. Ok, now, you have a form and UDCX file. With these files you can deploy it to any server, and before deploying, you can change connection by changing UDCX file, and without change form.
Ø Open you central admin, select “Application”.
Ø Select “Manage form template” of “InfoPath form service”
Ø Click “Upload”, browsing your form and with default configure upload your form.
Ø In “Manage Form Template” page, click your form and select “activate to a site collection”.
Ø Type your site where you will use this form.
Ø Back to “Application Management” and select “Manage Data Connection” of “InfoPath Form Service”.
Ø Click “Upload”, browse to your UDCX file and select “Allow HTTP access to this file”, then click “Upload”.
Ø Go to site you activate to, and create a document library with none type.
Ø Go to library settings, into Advanced Settings, set “Allow management of content types?” to true and click “OK”.
Ø Click “Add from existing site content types” , add “Product”.
Ø Back to library, click “new -> Product”, you can see your changed connection can be used.
http://msdn.microsoft.com/en-us/library/cc704269.aspx#ip2007BestPracticesFormTemplates_DebuggingFormTemplates