1

I am Using Infopath 2013 + SharePoint 2016. How can I hide a field in my form based on user group?

Any ideas? thanks

0

You can hide fields based on the SharePoint group membership in the InfoPath form. Check if the current user is a member of a group, then hide fields if the current user is not in the group.

In the form, use GetUserProfileByName (SOAP Web service: http://contoso.com/_vti_bin/UserProfileService.asmx) and GetUserCollectionFromGroup (SOAP Web service: http://contoso.com/_vti_bin/UserGroup.asmx) methods to check if the current user is in the specific group. If the current user is not a member of the “Hub Group” group, hide sections which the user has not access.

A demo about how to check if a user is a member of a SharePoint group in InfoPath:

How To: Check if a user is part of a SharePoint group in web based InfoPath form

An blog about how to use InfoPath data connection to build rules for hiding/disabling fields based on the SharePoint group membership of current user. Though the links are for InfoPath 2010, but should still have some good information.

Infopath List Form – hide/disable fields based on SharePoint group membership

Or we can use JavaScript code to achieve it. Check the article below.

Showing or hiding form fields based on membership in a SharePoint group

  • Hi , This doesn't work with SharePoint 2016 which is using claims authentication + Infopath 2013. The steps you provided work only with SharePoint 2010 and infopath 2010 – djgibbs Sep 7 '18 at 18:22
0

Follow below steps:

  1. Get Current user Login name using InfoPath fields and store it in a first hidden field.

  2. Use REST API to query all current user groups.

  3. Concat all group names and store them in a hidden field in the form.

  4. Then you will be able to create a rule to test if target group exist in the Hidden Field Value.

This took me 1 week to configure last year, Unfortunally, I dont have anymore access to the customer server. Sorry for that.

There is a SOAP Method that doesn't worked for me at that time because of a bug or incompatibility beetween SharePoint 2016 and InfoPath Designer 2013.

If you are using SP 2013 or 2010 please refer to this link.

Let me know if this was helpful for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.