How To: Show Different Information on the Same Form to Different Users
The objective of this example is to use one Form with different Form states for different events of the Workflow. Note that the SmartObject properties as displayed in the Views below are only for illustrative purposes and the only properties used in this scenario will be ID, Name, Surname, Manager Comments, Employee Comments and Rating.
For this example, we are using the Performance Appraisal Workflow. We want to achieve the following with this Workflow:
- An employee should be able to complete his appraisal details on an electronic form.
- The manager should be able to view the details of the appraisal completed by the employee and add his own comments and a rating.
- The employee and manager should use the same form but the manager comments and rating fields should not be visible on the employee's form. We are therefore using Form states for the different steps in the Workflow.
The Workflow is a simple Workflow where the employee completes the Appraisal Form to start the Workflow and is then routed to the manager to view and complete the Performance Appraisal Workflow as shown below
We've created a SmartObject with the Performance Appraisal properties required and used the SmartObject to create the following Item Views:
Create Performance Appraisal View
Performance Appraisal View
We then created a Form containing both Views and added a Submit Action button as shown below:
Performance Appraisal Form
Following is an explanation of the steps that are performed on each View and on the Form:
The employee opens the Performance Appraisal Form and see only the Create Performance Appraisal View as the other View and the Submit button are hidden from this event.
Once the Performance Appraisal Form is initialized, the following happens:
-
- The Performance Appraisal View is initialized
- The Performance Appraisal View is hidden
- The Submit Form control is hidden
- The Create Performance Appraisal View is initialized
The user will therefore only see the Create Performance Appraisal View. The employee completes the details on the View and click Create Form.
Once Create Form is clicked, the following happens:
-
- The details are created in the SmartObject
- The Performance Appraisal View is shown
- The Manager Comments label and text box are hidden on the Performance Appraisal View
- The Rating label and box are hidden on the Performance Appraisal View
- The Create Performance Appraisal View is hidden
- The Load method is executed on the Performance Appraisal View in order to load the details captured
- The Submit Form control is shown
The employee is now able to see the Performance Appraisal View on the same Form. He is however unable to see the Manager comments field or the Rating field as these are hidden. The employee completes the Form and click on Submit.
Once the Submit action button is clicked, the following happens:
-
- The information on the Form is saved to the Performance Appraisal SmartObject
- The Performance Appraisal Workflow is started
- The manager activity worklist item is started
The manager receives a worklist item in his worklist and opens the item. When opening the worklist item, the following happens:
- The Performance Appraisal View is initialized
- The Create Performance Appraisal View is initialized
- The Manager Activity Worklist item is opened
- The Create Performance Appraisal View is hidden
- The details are loaded from the Performance Appraisal SmartObject
The manager is able to view the appraisal details of the employee and capture comments and other details. He is also able to see the Manager comments field and the Rating field as these are not hidden from his view.
The application and runtime experience of this scenario are explained in the related topics
For a similar scenario using Workflow Task states, see the following article: