Question

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?

Was it helpful?

Solution 2

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.

OTHER TIPS

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!");
}
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top