Infopath view display selected sections based on user - InfoPath Dev
in

InfoPath Dev

Infopath view display selected sections based on user

Last post 03-14-2013 11:04 AM by Kamishiro_Takuto. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 03-13-2013 11:47 AM

    Infopath view display selected sections based on user

    Hi,

    I'd like to build a form with a second view created for as user's approval.

    The idea is that when the second view's form loads, it will only display a selected number of fields based on the user.

    Ex.

    Status
    ApproveButton RejectButton

    Name
    Entry1
    Entry2


    While loading, the form will search a custom list of authorized approvers

    If the user is among the authorized approvers , the Status field and Buttons appears and the rest of the field are set to read-only.

    If the user is either the user who created the entry or any other user, they will only view the Name, Entry1 and Entry2 fields as read-only view.

    Is there a way to do this? Thanks.

  • 03-13-2013 01:53 PM In reply to

    • Den12
    • Top 200 Contributor
    • Joined on 01-15-2013
    • Posts 57

    Re: Infopath view display selected sections based on user

    Yes there is. I have done something similar, but the lookup of the current user is against a Sharepoint Group.

    A) If you have that list of people in a Sharepoint list, you can run a query rule from a secondary connection to that list  and put the user account (from username() function) in the query field. Your list must be already prepared accordingly and contain the user accounts (in a text field) of all necessary people. Having just the names or the the accounts defined as Person or Group field on the list, will not allow you to do use the query fields as Person is not among those).

    B) Matching to a Sharepoint Group:

    You can check the link. It shows how to use and modify GetUserCollectionFromGroup web-service from Sharepoint.

    #1 Once you have completed the match you can store the result in a hidden field on the Infopath form, the use that field in formatting rules to disable/hide any controls you need, whole sections.

    For views, On Form Load:

      - use the first rule to specify to load the most restrictive view, then in another rule right after..

      - run an action rule to execute the queries as specified for the GetUserCollectionFromGroup.

         Use username() IP function to get the user if necessary. You can also use the GetUserProfileByName Sharepoint web-service in secondary data connection, but if your setup involves separate web-servers, it might be returning the AppPoolAccount. If not, use the Preferred Name field returned from that web-service.

     - Run Action rule, which Changes the View to the "Admin View" if the result/flag you saved (#1, above)  is what you are expecting for an admin or that special user/group.

    Hope it helps.

  • 03-14-2013 11:04 AM In reply to

    Re: Infopath view display selected sections based on user

    Thank You for the feedback.
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.