How can you filter a people picker field based on a SharePoint group?

  • 19 March 2018
  • 8 replies
  • 171 views

Badge +3

How can you filter a people picker field based on a SharePoint group?


8 replies

Userlevel 5
Badge +14

any further details on what you want to achieve?

it you restrict PP field/control to accept only users from a specific SP group it will do restrict possible inputs to the group members.

I'm not sure what further filter would you  mean.

Badge

For me, I need to put a number of groups names into a dropdown list box ( group1 => id=19, group2=>id=19, group3=> id=20.  Then when the value of the dropdown list box changes, update the value of the data-sharepointgroup on the people control so that the users being queried changes.

I basically need to assign a task to a list of people from one of the groups listed in the dropdown.

. I've toyed with use the _catalogsusers  hidden list but that isn't working out too well. I can seem to get the secret hand shake on specifying a hidden list as an expression in the list property..

Userlevel 5
Badge +14

that's, unfortunately, not possible with nintex. people control doesn't support to change source user group at runtime.

what you could do at mosty is to add a separate people control for each group. then use formatting rules which based on dropdown selection show respective people control and hide all the others.

Badge

True, there is no api - but the control behaves like a client-side control and there is a field on the control  data-sharePointGroup where the name if the group is specified.. It one were already familiar with the javascript nuances for the Nintex, it seems like it would be almost trivial to stuff the value of the dropdown listbox with the group name into data-SharePoint group field in the client side control.. Maybe I'm wrong.

Userlevel 5
Badge +14

if you want to bother with javascript, then try following

NWF$('#'+PPControl).data('sharepointgroupid',12345);
NF.PeoplePickerHelper.Initialize(NWF$('#'+PPControl));

replace '12345' with your real SP group ID

 

Badge +2

Hi, very usefull! 

However, I need to filter People Picker using a couple of gropus, e.g. 1234 and 5678.

How to do this?

Badge +9

Hi @mgragnani , were you able to filter your People picker field with multiple groups? I'm trying to apply the same. 

Badge +2

Unfotunately not... 

I have tried to script this but no chance, pls let me know if you find a solution

Reply