SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this community
Anybody can ask a question
Anybody can answer
The best answers are voted up and rise to the top
I have a scenario that was given to me. The scenario:
There is a List called Improvements for which a Requestor can make a submission.
Within this same list, the Admin can then make any approvals on the current item that the Requestor has submitted.
- There are 2 views on the InfoPath form. The Requestor View and the Admin View.
- There are also 2 controls on the InfoPath form. The first is a dropdown list box called Department, which is a column on the Improvements List. This control is also a Lookup from another List that stores users based on the Department that they belong in.
- The second control is a People Picker which displays the Admin responsible for making any approvals on the current item. This control gets populated when the user chooses a Department from the dropdown. When a Department is chosen, the People Picker gets populated with a user based on the Department chosen. For example, if the user chooses the Law department then the People Picker control gets populated based on the Department chosen.
What I’d like to know is, how can I restrict the Admin View from the Requestor?
When adding a New Item, the Requestor should be able to see the Requestor View. Afterwards, the Requestor is not allowed to see any other view except the Requestor View due to sensitive information. The only user allowed to see the Admin view is the Admin displayed in the People Picker.
I’m not sure what is the easiest method to accomplish what I need but any advice and steps are appreciated. How can I accomplish this?
Here’s the workaround that I use.
Step 1: Add a column to calculate current user
- Create a Single line of text column called CurrentUser
- In InfoPath, edit the properties of the column and change the default value to userName()
- Check the box for Refresh value when formula is recalculated
Step 2: Remove the Admin view from the drop down
- In InfoPath on the Page Design tab, click Properties under View:
- In the View settings section, deselect Show on the View menu when filling out this form
Step 3: Switch to admin view for admins
- On the Data tab, select Form Load in the Rules section of the ribbon
- Create a new rule (Action)
- Choose The expression from the drop down
Type the following expression in the text field, replace “username” with the username of your admin, 1 condition for each user (here’s 2):
contains(dfs:dataFields/my:SharePointListItem_RW/my:CurrentUser, "username") or (dfs:dataFields/my:SharePointListItem_RW/my:CurrentUser, "username")
Keep adding “or…” for however many Admins you have.
- Run these actions Switch views (select the admin view)
There may be a way for you to incorporate the people picker into this, but the solution above is a good workaround for me.