1

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?

  • Please see the link in the answer at sharepoint.stackexchange.com/a/84387/50547 – Aziz Kabyshev Apr 5 '16 at 23:58
  • Thanks for the reply. I see that I can restrict a View based on a Group but for some reason on the second answer second link provided by you it says further down that I need to use the GetUserCollectionFromGroup method. The problem is, that method was not available from the selection. What else can I try? – Aspire27 Apr 6 '16 at 1:02
0

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)
  • Condition:
  • 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.

  • Thanks for the response. Based on your post, the expected outcome is that when Requestor finishes submitting the form, the Requestor has no access to the Admin view of the form whether it be going to the item in the List and clicking Edit nor through any hyperlinks through email notifications? Reason why I ask is that within the expression I typed in the user "jane.doe". I tested by submitting a new form as jane.doe but when I went to Edit the file, the Admin view is still viewable. ON the other hand jane.doe is a Farm Admin so not sure if that has any bearing. Please advise. – Aspire27 Apr 6 '16 at 21:11
  • The users in the expression are the Admins, not the requesters, so when they open the form, InfoPath rules will redirect them to the Admin form. Farm Admin should have no bearing. Make the Request view the default view so that requesters only see that view. If you need Admins to also be able to fill request forms and then not have access, that will take a little more work. – AtariPixel Apr 7 '16 at 6:56
  • I see thanks. One more thing. I'm not savvy in InfoPath and was wondering, within the expression, what can be done to restrict the Admin view to a Group instead of using the username? – Aspire27 Apr 7 '16 at 14:57
  • I'm not sure if this can be done from within this expression. InfoPath has to have a way of importing the users, so making a custom list with all the usernames, then creating a data connection with the list may be a workaround. I've seen others post about this method on Stack Exchange. Also, if this solution is at all helpful, please consider upvoting, thanks. – AtariPixel Apr 8 '16 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.