1

I want to count the People added to a People Picker field. In my Document library there should be a column "UserNumber" and in this column the Number of users of the People picker field for every Document in the Library should appear.

I have found this entry: Count number of users in people picker using Javascript

Thank you.

1 Answer 1

0
function GetUserCount() 
{ 
//Where "Multiple_Users_Field" may refer to name of the user field or the Title of Div can be retrieving from inspecting from browser
var PickerTitle = "Multiple_Users_Field"; 
var PickerDiv = jQuery('[id$="ClientPeoplePicker"][title="' + PickerTitle + '"]');
var PickerEditor = PickerDiv.find('[title="' + PickerTitle + '"]');
var PickerInstance = SPClientPeoplePicker.SPClientPeoplePickerDict[PickerDiv[0].id];
return  PickerInstance.TotalUserCount
}

alert( GetUserCount() );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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