Change different view in InfoPath 2010 based on certain condition in SharePoint 2010

This InfoPath 2010 tutorial explains how we can change to different views in InfoPath 2010 form based on a certain condition in SharePoint 2010.

Suppose an employee sends a leave request to a company. Then the request may go to Team leader, HR etc. So whenever an employee opens the InfoPath form he should see his information relevant to him, Similarly Team leader should see the relevant information to team leader. And the similar case with HR also. So in this type of scenarios, we will create different views in InfoPath, one view for the employee, one for team leader and one for HR.

Follow the below steps:
1. Activate SharePoint server enterprise site collection features

2. Create the needed users

3. Create your custom list with following columns.

change different views based on conditional formatting
change different views based on conditional formatting



4. Now click on list tab-> customize form on the ribbon to create multiple views.

5. Now it will open your list in InfoPath form.

6. Now we will remove the unwanted columns – Title, Attachment, Action, State.

7. Click on PageDesign -> New view -> give the name of the view – Employee view, Team leader view.

8. Then copy the edit view and paste in your Employee view.

9. Keep the desired fields and delete the rest.

10. Add two button for submitting and cancel. Home->Control->Button.

11. Now do the same for manager view. Here three button- Approve, Reject, Cancel.

12. Then we will add rules for switching views.

13. Click on Data Tab -> Form load -> New -> Action -> Type Show employee view -> condition -> status is blank -> switch views -> Employee view. see fig below


infopath change different views
infopath change different views

14. Do same to show TL view. Only add the condition as status -> is equal to -> WaitingTL. see fig below

infopath change different view based on field, infopath 2013 switch views
infopath change different view based on field, infopath 2013 switch views

15. Now go to Employee view -> submit button -> New -> Action -> Give name as SubmitEmployee-> Add-> set field value:Action= SubmitEmployee -> submit data using data connection -> close the form

16. Cancel button -> new -> name :cancelemployee -> add -> close form

17. Go to TL view -> Approve button -> New -> name :ApproveTeamLeader -> set field value: ApproveByTL-> Submit data -> close form.

18. Do same for reject button only change the set field value as RejectTL.

19. Cancel button has the same rule as in Employee view.

20. Now save and publish the InfoPath form.

21. Now go to your list and add the new item. It will show you the employee view.

22. Here you fill in the details and submit.

23. Click on datasheet view from ribbon and change the status to WaitingTL.

24. Now come to your item. Click on the item it will show you the TL view. And here you can approve the employee.

You may like following InfoPath 2010 tutorial:

Hope this will be helpful to change different views in InfoPath 2010 based on certain conditions in SharePoint 2010.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.

>