Created Restricted View on InfoPath Form

I've found a great way to create a restricted view in an InfoPath form by using a great tool called the GetUserMemberships Web Service.

Solution: In your InfoPath Form select Add New Data Connection - Receive Data - SOAP Web Service. Type the following url: http:///_vit_bin/UserProfileService.asmx?WSDL. Make sure the GetUserMemberships item is selected and click Next then Finish.

Now that you have the connection made, it's time to put it to use. The GetUserMemberships Web Service will query every AD and SharePoint group that the current user is apart of.

So, to create my hidden view in the form, I first went into form options and unchecked the Views item so that it won't be displayed in the InfoPath web toolbar. You have to be sure to uncheck this option or else the form won't be restricted. We will use custom buttons to switch between different views. We will place code inside the button that will show or hide it based on the current user's information.

One caveat to this method is that if you try to call the secondary data source web service directly, it will only pick up the first group that the user is a member of, therefore, you cannot use any rules based on this.

Now, here's the workaround for that. Assuming you know the particular group that you want to be able to see the view, create a hidden text field with a default value of GetUserMemberships data source. Apply a filter to the value that takes where DisplayName =

Now all that's left to do is to add a button that switches to the view and insert a formatting rule which hides the button unless the field you created equals the desired value.