Display a certain field based on the viewing user - InfoPath Dev
in

InfoPath Dev

Display a certain field based on the viewing user

Last post 08-20-2013 03:55 AM by wilkies0106aw. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 08-16-2013 10:30 AM

    Display a certain field based on the viewing user

    I currently have one section which holds a people picker control that populates the current user. Once the form is submitted, I need a section of the form to be displayed based on a group of users. So far, I have created a SharePoint  list of these users. In the hidden section, there is a people picker that would populate the user from the list which views the form. The issue I am running into is building the logic to display the section and populate the user. Would I need create a rule to populate the second people picker (from the hidden section) based on the username, then filter the results based on the SharePoint list? How would I then show the field when that user views the form? All responses are greatly appreciated.   

  • 08-18-2013 03:55 PM In reply to

    Re: Display a certain field based on the viewing user

    Hi Tim Sedona and welcome,

    To get current user you should use either the userName() function or SharePoint's UserProfileService, or Qdabra's Active Directory Web service. First two options are out-of-box. The People Picker is used to add users to your form that should get email notifications, etc. If you are trying to assign a form to a user using People Picker, you can integrate it with UserProfileService to query the names and get the groups, but it's a bit of a pain to extract the data if you have more than one user that needs to be selected.

    Anyway, once you verify that the aliases (usernames) you get back from your People Picker plus UserProfileService query correspond to the actual column values in your SharePoint list of user/groups (note: I'm assuming this ShP list has group information in it but you could use the UserProfileService to get group info), you just set the group info in a field in your main data source and then add formatting on the section to hide if the current user is not in the group. You can look up the user by filtering the secondary SharePoint list data source or querying the UserProfileService. Take a look at Clayton Cobb's SharePoint Madness site for a great example of getting group info.

    Eminently doable. Best of luck,

    Patrick Halstead
    Project Manager at Qdabra
  • 08-19-2013 08:42 AM In reply to

    Re: Display a certain field based on the viewing user

    Hello Patrick

    I understand the UserProfileService and the username function(). These are working great in the contact section. Please forgive I don't think I explained it very well. The form is created for a user to fill out and submit. Once there is a submission, I have a workflow to send an email to the owning team of the form, notifying them there is a new request. The next step where I am having trouble. Once the form is submitted and a user of the owning team opens the form, they are asking for a section to be only seen by their team.

    I tried setting an Action rule on the field to query the UserProfileService, then set the condition to Account Id is not equal to Account ID (of the secondary connection, owning team users) but to no avail.

    Would the owning team need to open the form in edit in order for the rule to run?

  • 08-20-2013 03:55 AM In reply to

    Re: Display a certain field based on the viewing user

    You can put your field in a section and only show it when X people open the form.  I'd also have 2 views and a form status field. 1. Submitter, 2. Team X. - then depending on the form status you could open view Team X.

     

    To help troublshoot add a dummy current user field, that way you can see who the form thinks is opening the form and it will help you with your formatting rule.

     

     

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.