Lab 7: Creating User Roles in InfoPath 2003
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
Summary: Discover how to create a view and user roles for a form, set up rules based on the roles, and preview a form with specific user roles. You will also learn how to switch views based on user roles. (5 printed pages)
Updated August 2007
Applies to: Microsoft Office InfoPath 2003
Download the odc_INF03_Labs.exe sample file.
The management team at Contoso Corporation reviews each Office InfoPath 2003 form that sales representatives fill out. Because the management team is interested only in sales deals that exceed a certain amount of money, your department is asked to add an additional view to the sales form that shows only those deals.
Exercise 1: Add a View
The Contoso sale report form has a default view, called "View 1 (default)," which sales representatives see when they open and fill out a form. In this exercise, you rename the default view and add a blank view to the form.
Before you can create a view, open the form in design mode.
To open the form in design mode
In the Fill Out a Form dialog box, click Design a Form.
In the Design a Form task pane, click On My Computer.
In the Open in Design Mode dialog box, locate the folder where you installed the training files, and then double-click the Lab 7 folder.
Select Lab7Template.xsn, and then click Open. The Contoso sales report form opens in design mode.
Before you add a view to the form, it is a good idea to give the default view a more descriptive name.
To rename the default view
In the Design Tasks task pane, click Views.
In the Select a view list in the Views task pane, click View 1 (default), and then click View Properties.
On the General tab of the View Properties dialog box, in the View name box, type Employee View.
In the Views task pane, the view name has been changed to Employee View (default). You can now add a view to the form.
To create a view
In the Views task pane, under Actions, click Add a New View.
In the Add View dialog box, type Manager View.
At this point, you have added an empty view to the form.
Exercise 2: Add Content to the View
You have to add content to the empty view that you created in the previous exercise. The management team wants the view to look the same as the default view of the sales report, but with a few customizations. The easiest way for you to create this view is to copy the contents from the original view into the new view, and then make the requested modifications.
To copy the contents of the default view
With the form still open, in the Views task pane, click Employee View (default) in the Select a view list.
On the Edit menu, click Select All.
On the Edit menu, click Copy.
In the Views task pane, under the Select a view list, click Manager View.
On the Edit menu, click Paste.
The two views should now look identical. To avoid confusion between the two views, you can apply a different color scheme to the Manager view.
To apply a color scheme
On the Format menu, click Color Schemes.
In the Color Schemes task pane, click Blue.
Now that the two views look different, you can start making modifications to the new view. The management team is only interested in the total sales that exceed $1,000. That means that you need to filter out any unwanted information. Before you create a filter, change the field name that is associated with the Total text box. This makes it easier to identify and work with the field in the data source.
To rename the Total field
In the form, under Total in the repeating table, double-click the text box.
In the Text Box Properties dialog box, on the Data tab , type total in the Field name box.
Now that you have renamed the field, you are ready to apply a filter to the form. This filter allows managers to filter for total sales that exceed $1,000.
To apply a filter
In the form, below the repeating table, double-click the Repeating Table label.
In the Repeating Table Properties dialog box, click the Display tab, and then click Filter Data.
In the Filter Data dialog box, click Add.
In the Specify Filter Conditions dialog box, click total in the first box under Display data that meets the following conditions.
In the second box, click is greater than.
In the third box, click Type a number, and then type 1000 in the box.
Close all open dialog boxes.
Exercise 3: Create User Roles
The sales form now has two views, one for sales representatives and another for the management team. To associate the correct view with its intended users, you must create user roles for the form.
The following procedure assumes that you already created two groups in Active Directory services: contoso\employees and contoso\managers.
To create a role
With the form still open, on the Tools menu, click User Roles.
In the Manage User Roles dialog box, click Add.
In the Role name box in the Add User Role dialog box, type Employee.
Select the Group name check box, and then type contoso\employees in the Group names box.
In the Add User Role dialog box, select the Set as initiator check box, and then click OK.
In the Manage User Roles dialog box, click Add.
In the Role name box in the Add User Role dialog box, type Manager.
Select the Group name check box, and then type contoso\managers in the Group names box.
After you add user roles to the form, the Manage User Roles dialog box should look like Figure 1.
Exercise 4: Switch Views Based on User Role
Now that you have created two user roles for the form, you can use rules to specify which view of the form is displayed, based on the user's role when they open the form.
To apply rules to the form
With the form still open, on the Tools menu, click Form Options.
In the Form Options dialog box, click the Open and Save tab, and then click Rules.
In the Rules for Opening Forms dialog box, click Add.
In the Rule dialog box, click Set Condition.
In the Condition dialog box, click User's current role in the first box under Apply the rule when this condition is true.
In the second box, click is equal to.
In the third box, click "Employee," and then click OK.
In the Rule dialog box, click Add Action.
In the Action list in the Action dialog box, click Switch views, and then click OK.
To add a rule for managers, repeat steps 3 through 9, except in step 7 click "Manager" instead of "Employee."
Exercise 5: Preview the Form Based on User Role
Now that you created a second view of your form and added user roles and rules, you should preview the form to make sure it works correctly. InfoPath lets you preview a form with different roles applied.
To preview a form with roles
With the form still open, point to Preview Form on the File menu, and then click With User Role.
In the Choose User Role to Preview dialog box, click the role you want to use to preview with the form.
For more information about InfoPath, see the following resources: