Web based InfoPath 2007 forms do not support the Role Based Access that is available as an InfoPath 2007 client form; so we need a work-a-round:
Scenario:
You create an application form that needs to be filled out and completed by various types of users:
- User A needs to fill out and submit the form by selecting a "Submit for Approval" button.
- User B needs to approve the form by selecting and "Approve" button.
- User A must not see "Approve" button.
Solution:
- Create your form.
- Add an "Approve" and "Submit" button.
- Add the following fields (do not include them in the form):
- "CurrentlyLoggedInUser" (text field) and "Profile" (text field)
- Set the default value of this field to be the fuction "CurrentUser()"
- Add a rule to the "CurrentlyLoggedInUser" field to update the value of the "Profile" field to "1" is the user contains the username of the person who is an approver. Else set the value to "0".
- Add conditional formatting to the "Approve" button to only display the button if the "Profile" field is equal to "1"
- Note: The conditional formating will not work based on the value of "CurrentlyLoggedInUser"
- Add conditional formatting to the "Submit" button to only display the button if the "Profile" field is equal to "0"
- Done.