Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

SPClientPeoplePicker - removing duplicates and counting the number of resolved people on client

$
0
0

Greetings

I am using SP2013 online.  I have a People Picker column in which I allow multiple people to be entered.  To prevent users from accidentally entering names multiple times, I am trying to remove any duplicates then get a count of the remaining resolved names before the record is committed.  Sharepoint removes duplicate people upon committing the record, but the count of the users is used in subsequent processing so I need to obtain and save an accurate count of unique users on the record as well.

So far, I can successfully get a count of all resolved people, but I'm having a difficult time coding the duplicate checking:

function GetPeoplePickerCount (){ jCtrl = "[id$='ClientPeoplePicker'][title='PeoplePickerColumn']"; var peoplePickerDiv = $(jCtrl); var peoplePickerEditor = peoplePickerDiv.find("[title='PeoplePickerColumn']"); var spPeoplePicker = SPClientPeoplePicker.SPClientPeoplePickerDict[peoplePickerDiv[0].id]; var ResolvedUsers = $(document.getElementById(spPeoplePicker.ResolvedListElementId)).find("span[class='sp-peoplepicker-userSpan']");

// CODE TO CHECK AND REMOVE DUPLICATES????????

var count = spPeoplePicker.TotalUserCount - spPeoplePicker.UnresolvedUserCount; $("Input[type='text'][id^='CountOfPeople']").val(count); }


Anyone willing to give me a hand with this?  Much thanks in advance!



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>