Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
Learn how to start a workflow on an Office InfoPath 2007 form, and then complete tasks that are part of that workflow from within InfoPath. (5 printed pages)
February 2007
**Applies to:**Microsoft Office InfoPath 2007
Contents
Lab Objectives
Lab Setup and Requirements
Scenario
Exercises
Conclusion
Additional Resources
After completing this lab, you will know how to do the following:
Add a workflow to a form library.
Start a workflow from within Office InfoPath 2007.
Complete workflow tasks from within InfoPath.
Add workflow status and other metadata to an InfoPath form template.
Use workflow status in form template business logic.
To complete this lab, you must have the following:
Microsoft Office InfoPath 2007
Access to a Microsoft Office SharePoint Server 2007 server
Note
If you install both applications on the same computer, you can replace <ServerName>, which is a placeholder for the name of your Office SharePoint server in the following steps, with "localhost." Otherwise, replace <ServerName> with the name of your Office SharePoint server.
A manager at Contoso Corporation wants employees to get approval for any company travel before they schedule it. To do this, the manager will use a form library in Microsoft Office SharePoint Server 2007, the preconfigured Approval workflow, and the InfoPath Travel Request sample form.
The first step will be to create the form library and add the workflow to it.
Start InfoPath.
In the Getting Started dialog box, click Design a Form Template.
Click Customize a Sample.
Double-click Sample - Travel Request.
On the File menu, click Publish.
If you are prompted to save the form, select the Always save the form when publishing check box, and then click OK.
Click Save to save the form to My Documents.
Click To a SharePoint server with or without InfoPath Forms Services, and then click Next.
Type http://<ServerName>/, where <ServerName> is the name of your Office SharePoint server, and then click Next.
Click Document Library, and then click Next.
Click Create a new document library, and then click Next.
In the Name box, type Travel Requests, and then click Next.
Click Next again, and then click Publish.
Select the Open this document library check box, and then click Close.
In Internet Explorer, open the form library you created (http://<ServerName>/Travel Requests/).
On the Settings menu, click Form Library Settings.
In the Permissions and Management section, click Workflow settings.
In the Workflow Template list, click Approval.
In the Name box, type Approval.
Click Next.
Review the workflow settings, and then click Next.
Review the initial workflow settings, and click OK.
Click Travel Requests in the navigation link above the title Change Workflow Settings: Travel Requests to return to the form library.
Use InfoPath menus to begin a workflow associated with the form library, and use the yellow bar below the menus to complete an active workflow.
In Internet Explorer, open the form library you created (http://<ServerName>/Travel Requests/).
Click New.
When the form opens in InfoPath, click Save on the File menu.
Click Save again to save the form back to the form library.
On the Tools menu, click Start Workflow.
On the Workflows dialog box, click Start.
In the Approval dialog box (shown in Figure 1), click Approvers.
Figure 1. Adding approvers in the Approval dialog box
Search for your name, select it, and then click Add.
Review the initial workflow settings, and click Start.
In InfoPath, open the form that you saved to the form library.
At the top of the InfoPath form, on the yellow bar labeled Workflow Task, as shown in Figure 2, click Edit this task.
Figure 2. Editing a task in the Workflow task bar
Click Approve.
Close the form and return to the Office SharePoint Server library.
The workflow status shows Approved in the Approval column.
Using the workflow status in the form requires setting up a data connection to retrieve the workflow information from the site. Using the workflow status in business logic enables you to switch to another view based on the workflow status.
Return to the Travel Request form template in design mode, either by opening it from the location where you saved it or by switching to the instance of InfoPath that contains the Travel Request form template.
On the Tools menu, click Data Connections.
Click Add.
Click Create a new connection to and Receive Data, and then click Next.
Click SharePoint library or list, and then click Next.
Type http://<ServerName>/, and then click Next.
Select the library that this form template is published to (Travel Requests), and then click Next.
Select the Include data for the active form only check box, and then click Next.
Review the offline settings, and then click Next.
Review the remaining settings, and click Finish.
Click Close to close the Data Connections dialog box.
On the View menu, click Data Source.
In the Data Source task pane, select Travel Requests (Secondary) in the Data source list. Expand dataFields and Travel_Requests in the task pane, as shown in Figure 3.
Note
The Approval field is now available to all the business logic features in InfoPath.
Figure 3. Viewing the Approval field in the Travel Request Data Source
The Travel Request form template should be open in design mode. On the View menu, click Manage Views.
In the Views task pane, click Add a New View.
Name the view Approved, and click OK.
Type This travel request has been approved in the new view.
On the Tools menu, click Form Options.
In the Form Options dialog box, click the category Open and Save.
In the Open behavior section, click Rules.
Click Add.
Click Set Condition.
In the first drop-down list, click Select a field or group.
Click Travel Requests (Secondary) in the Data source list.
Expand the data source, click the Approval field, and then click OK.
In the third drop-down list, click Type text.
Type 16, which corresponds to Approved, and then click OK.
Click Add Action.
Click Switch views for the action.
Note that the Approved view is selected, and click OK.
The completed Rules dialog box should look like Figure 4.
Figure 4. Completing the Rules dialog box
Click OK in all remaining dialog boxes.
Republish the form by clicking Publish on the File menu.
In the Publishing Wizard, continue to click Next through the wizard pages until the Publish button appears.
Click Publish, and then after the form is published, click Close to close the Publishing Wizard.
Browse to the document library, and open the previously completed form, Form1.
Note
The view switches because the workflow is Approved.
In these exercises, you learned how to create form libraries that use workflow, how to start a workflow and complete workflow tasks from within InfoPath 2007, and how to create InfoPath form templates that incorporate workflow status into business logic.
For more information about developing with InfoPath, see the following resources: