2

On people picker column where is allowed multiple entries, I should restrict entry to only one user in edit form.

To explain why I need this.
Users can enter multiple values to people picker column in new form, after saving item SPD workflow creates as many new items as there were users in people picker column and deletes original item. So in newly created items there is only one user in people picker column.

What I now need is to restrict users to enter additional users in edit form.

I found that there is SPServices function SPFindPeoplePicker, here but not sure how to pull pull number of entries from dictionaryEntries.

Another thing that came up my mind is to check in workflow if there is on item edit on people picker column more than one user and if yes to leave only first entry.

Other than these, I found nothing. Do you have any idea and suggestion how could this be achieved maybe easier?

1

Something like this: You can also tie this to the PreSaveItem of the form to prevent saving.

var getIDPeoplePicker=$("div[title='People Column Title']").id;
var ppobject = SPClientPeoplePicker.SPClientPeoplePickerDict[getIDPeoplePicker];
var usersobject = ppobject.GetAllUserInfo();

if(usersobject.length >= 1)
{
  alert("Only 1 user please!");
}
| improve this answer | |
  • but this is client people picker, no? That would mean I have to change my people picker 2010 to client people picker. – Danilo Nov 20 '17 at 7:13
  • Not sure what you mean there. This will find the people picker field that see if there are more than one user filled in. See here for more: ranaictiu-technicalblog.blogspot.com/2014/11/… – Mike Nov 20 '17 at 14:17
0

I solved it with SPD workflow 2013.
It would be much better if I did it on client side, on browser, but I didn't have much time to make it work so I turned to WF and solved it as I guessed in question.

On item edit, WF checks on people picker column how many users are in it. I did it by checking how many ; are in it. as sign ; represents border of two users.
If there is more than 1 ; than in wf variable only 1st value will be saved and inserted to people picker column, deleting every other entry.

I know it is not ideal solution but until I get to work client side people picker script I think this will work fine.

| improve this answer | |

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.