Tuesday 20 September 2016

How to switch view of infopath form only for intended users in SharePoint

Hello Everyone

So i am ready for writing this blog. Here situation is something like that i have four view to my InfoPath form. First is for who is filling and submitting. Second for recommencement like some one who will recommend this for further approval by Approver, third is for Approver. and fourth one for others if u want to show them may be your read only view. and you want that One should not be able to see the others view.

Tricks which you have to use are Username function and GetuserprofileByName Service.

1.      Set a field value is equal to username function in first view

2.      You have to keep a text field hidden in your infopath form in which Current login user value will be stored by getUserProfileServicebyName service.To see How to Use getserProfileService CLICK HERE

3.      Go to Properties tab of infopath form and choose manage rules.(If you have inserted any section in your infopath form otherwise go to Home tab)

4.      Click on New Rule as Action. Leave the condition as blank .In the Run these action choose Query for data using getuserprofileservice.

5.     Then again Click on Add and choose set a Field value. Choose your hidden field created in step 2. and set AccoutName.

6.     Now go to Data tab of infopath form and click on FormLoad to define conditions when form will open by any user.

7.     Click on NEWRULE ---Action type - For first User set condition choose field in which you have set the username function is equal to Choose hidden field in which value is received from getuserprofileservice.

        Then Click on ADD---> SWITCH VIEW TO FIRST VIEW.

8.      Set New FORM LOAD RULE- For recommending user set condition choose field in which you have set recommenders name is equal to Choose hidden field in which value is received from getuserprofileservice.

        Then Click on ADD---> SWITCH VIEW TO SECOND VIEW.

9.     For APPROVER user set condition choose field in which you have set Approvers name is equal to Choose hidden field in which value is received from getuserprofileservice.
   
       Then Click on ADD---> SWITCH VIEW TO THIRD VIEW.

10.    For Other users Set New FORMLOAD Rule-- set three conditions saying firstusername is not equal to hidden field value, Recommeder is not equal to hidden field value, and Approver is not equal to hidden field value.

       Then Click on ADD--->SWITCH VIEW TO FOURTH VIEW.

If there are any misunderstanding write below i will clear them.

No comments:

Post a Comment