​Show/Hide Controls In InfoPath Form For SharePoint Lists - Part Two

In the previous article found here, we saw how to capture the logged in user's details - whether they belong to HR or Leadership level using InfoPath rules and create the necessary flags for further usage.
 
In this article, we will continue the same with creation of rules that actually perform the task of hiding the sections, as per the flags we received in the first article. Finally, we will conclude with the usage of this solution by testing out multiple scenarios.  
 
Step 5 - Create a flag for leadership user
 
In this step, we will create a rule to identify if the logged in user is from Leadership. Let us name the rule “Confirm Leadership user”. All the steps are the same as Step 2, except the fields changes to “isCurrentUserLeader” and one of the filter conditions form Permission Level changes to “Leadership. The changes are reflected in the screenshots below:
 
​Show/Hide Controls In InfoPath Form For SharePoint Lists
 
​Show/Hide Controls In InfoPath Form For SharePoint Lists
 
Step 6 - Hide the HR section for non-HR users
 
In the section for HR, add a formatting rule named “Enable HR view”. In the condition, select isCurrentUserHR and set the condition as “is blank”. After these changes are made, check the setting “Hide this control”
 
​Show/Hide Controls In InfoPath Form For SharePoint Lists
 
Step 7 - Hide the Leadership section for non-Leadership user
 
Similar to Step 6 above, add a formatting rule named “Enable Leadership view”. In the condition, select isCurrentUserLeader and set the condition as “is blank”. After these changes are made, check the setting “Hide this control”
 
​Show/Hide Controls In InfoPath Form For SharePoint Lists
 
With this, all the steps are completed. Publish the form now. Time for testing it out!!
 
Step 8 - Usage and Testing
 
Now, if you do not have any entry in the Permission Configuration list, both the sections will be hidden from you.
 
​Show/Hide Controls In InfoPath Form For SharePoint Lists
If your entry is added as “HR”, you will be able to see the HR section,
 
​Show/Hide Controls In InfoPath Form For SharePoint Lists
​Show/Hide Controls In InfoPath Form For SharePoint Lists 
And if your entry is added as “Leadership”, you will be able to see the Leadership section,
 
​Show/Hide Controls In InfoPath Form For SharePoint Lists
​Show/Hide Controls In InfoPath Form For SharePoint Lists 
Finally, if two entries are added against your name for both HR and Leadership, you will be able to view both the sections.
 
​Show/Hide Controls In InfoPath Form For SharePoint Lists
 
​Show/Hide Controls In InfoPath Form For SharePoint Lists
 
This concludes the article! This article can also be found in my personal blog - CollabLogic. Thanks for stopping by, and have a nice day!