Microsoft Office InfoPath 2003 Training
Lab 7: User Roles in InfoPath 2003
 

Microsoft Corporation

April 2004

Applies to:
    Microsoft® Office InfoPath® 2003

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)

Contents

Scenario
Lab Objective
Exercises
Conclusion

Download the odc_INF03_Labs.exe sample file.

Scenario

The management team at Contoso Corporation reviews each of the Microsoft® Office InfoPath® 2003 forms 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.

Lab Objective

In this lab, you learn how to do the following:

  • Add an additional view to a form
  • Create roles for a form
  • Use rules to display different views based on the user's current role
  • Preview the finished form

Exercises

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

  1. Start InfoPath.
  2. In the Fill Out a Form dialog box, click Design a Form.
  3. In the Design a Form task pane, click On My Computer.
  4. 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.
  5. Select Lab7Template.xsn, and then click Open. The Contoso sales report form opens in design mode.

Before adding a view to the form, it is a good idea to give the default view a more descriptive name.

To rename the default view

  1. In the Design Tasks task pane, click Views.
  2. In the Select a view list in the Views task pane, click View 1 (default), and then click View Properties.
  3. On the General tab of the View Properties dialog box, in the View name box, type Employee View.

Note that 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

  1. In the Views task pane, under Actions, click Add a New View.
  2. 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 need 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

  1. With the form still open, in the Views task pane, click Employee View (default) in the Select a view list.
  2. On the Edit menu, click Select All.
  3. On the Edit menu, click Copy.
  4. In the Views task pane, under the Select a view list, click Manager View.
  5. 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

  1. On the Format menu, click Color Schemes.
  2. 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

  1. In the form, under Total in the repeating table, double-click the text box.
  2. 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're 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

  1. In the form, below the repeating table, double-click the Repeating Table label.
  2. In the Repeating Table Properties dialog box, click the Display tab, and then click Filter Data.
  3. In the Filter Data dialog box, click Add.
  4. In the Specify Filter Conditions dialog box, click total in the first box under Display data that meets the following conditions.
  5. In the second box, click is greater than.
  6. In the third box, click Type a number, and then type 1000 in the box.
  7. 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.

Note   The following procedure assumes that you already created two groups in Microsoft Active Directory® services: contoso\employees and contoso\managers.

To create a role

  1. With the form still open, on the Tools menu, click User Roles.
  2. In the Manage User Roles dialog box, click Add.
  3. In the Role name box in the Add User Role dialog box, type Employee.
  4. Select the Group name check box, and then type contoso\employees in the Group names box.
  5. In the Add User Role dialog box, select the Set as initiator check box, and then click OK.
  6. In the Manage User Roles dialog box, click Add.
  7. In the Role name box in the Add User Role dialog box, type Manager.
  8. Select the Group name check box, and then type contoso\managers in the Group names box.

The Manage User Roles dialog box should look like this after you add user roles to the form:

Click here for larger image.

Figure 1. Manage User Roles dialog box (Click picture to view larger image)

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

  1. With the form still open, on the Tools menu, click Form Options.
  2. In the Form Options dialog box, click the Open and Save tab, and then click Rules.
  3. In the Rules for Opening Forms dialog box, click Add.
  4. In the Rule dialog box, click Set Condition.
  5. In the Condition dialog box, click User's current role in the first box under Apply the rule when this condition is true.
  6. In the second box, click is equal to.
  7. In the third box, click "Employee," and then click OK.
  8. In the Rule dialog box, click Add Action.
  9. In the Action list in the Action dialog box, click Switch views, and then click OK.
  10. 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

  1. With the form still open, point to Preview Form on the File menu, and then click With User Role.
  2. In the Choose User Role to Preview dialog box, click the role you want to use to preview with the form.

Conclusion

After completing this lab, you should know how to create a view for a form, create user roles, set up rules based on those roles, and preview a form with specific user roles.