About specifying user roles for forms

In Microsoft Office InfoPath 2003, you can assign users to distinct categories, called "user roles," which are based on job title or other criterion.

User roles are often used to present customized views (view: A form-specific display setting that can be saved with a form template and applied to form data when the form is being filled out. Users can switch between views to choose the amount of data shown in the form.) of a form to different types of users. For example, a form that is used to collect feedback about job applicants might have three distinct user roles associated with it—one for recruiters, one for interviewers, and one for hiring managers. For each user role, you can present users with a slightly different view of the form.

Security  You should not use roles to restrict access to sensitive data in a form. Even if you make a form read-only or hide certain controls based on roles, users can potentially use a text editing program such as Microsoft Notepad to view or modify the form (.xml) file.

User role assignments

When designing a form, you can add, modify, or delete user roles by using the Manage User Roles dialog box.

When you create a new user role, you can assign users to it in the following ways:

After you create a user role, you can set it as one of the following roles:

Default role    Users who are not assigned to an existing user role are automatically assigned to the user role that is specified as the default role. The default role is also used for users who are part of a group but who are working offline. One user role is always set as the default.

Initiator role    If you want to apply a particular user role to users who open your form for the first time, you can specify an initiator role. For example, you can define an initiator role named "Project Owner" that applies to users who fill out new project specification forms. A user who is assigned to a different user role is automatically reassigned to the project owner role when he or she opens a new project specification form. However, the next time that user opens the same form, InfoPath uses the person's assigned user role instead of the initiator role.

When a user opens a form, InfoPath determines whether that user is assigned to an existing user role. For example, if the user role assignments are determined by network name, InfoPath checks the user's name against the user's network credentials before opening the form. In the form, the name of the current user role appears on the status bar.

Working with user roles

After you define user roles for your form, you can set up a rule (rule: A condition or action, or a set of conditions or actions, that automatically performs tasks based on events and values in the form.) that automatically performs a task, such as switching views, based on events and values in the form. For example, you can create a manager user role and then create a rule to automatically switch the view when a manager opens the form. Alternatively, you can create the rule first and then define user roles as part of the process of creating the rule.

You can also vary a control's behavior based on a user role. For example, if your expense report form contains manager and employee roles, you can use conditional formatting (conditional formatting: The process of changing the appearance of a control, including its visibility and read-write state, based on values entered into the form.) to make the text inside a Total Expenses box turn red when employees accrue more than $500 in expenses or managers accrue more than $1,000. Similarly, you can vary the control's data validation (data validation: The process of testing the accuracy of data; a set of rules you can apply to a control to specify the type and range of data that users can enter.) or filter (filter: A set of conditions that is applied to data in order to display a subset of the data.) settings based on user role.

Testing user roles

If a form has multiple user roles, you can use the Preview Form With User Role command to test the appearance and behavior of each distinct role. For example, if you created a special summary view of your form for managers, along with a rule that switches the view based on user role, you can test that view with the manager role. In the preview window, the name of the current user role appears on the status bar.

When you test a form in the preview window, make note of the following:

  • Although you can preview a form to check that views work as you expect with user roles, you won't be able to simulate the process of evaluating a user against the user's given role assignment. That's because InfoPath checks user roles when you fill out the form, not when you preview it. If you want to fully test the user roles for your form, you can temporarily assign yourself to each user role that you want to test and then open the form as if you are going to fill it out.
  • If you click Preview Form on the Standard toolbar (or use the Preview Form Default command on the File menu) to preview your form, you'll see the view that's associated with the default user role in the preview window, regardless of your own role assignment. To preview other user roles, use the Preview Form With User Role command instead.

 Note   The information in this topic may not apply if you are working with a form designed using Microsoft Office InfoPath 2003 without the service pack installed.

 
 
Applies to:
InfoPath 2003