AnsweredAssumed Answered

Loop through People Picker Extension

Question asked by jonaroy on Feb 7, 2018
Latest reply on Feb 9, 2018 by emha

I'm trying to figure out, how it's possible to use the PeoplePicker API multiple times. (Add a SP-User from a textfield into the people picker control in a repeating section.)

 

Following is a sample of my actual code:

 

function test(){
NWF.FormFiller.Events.RegisterAfterReady(function () {
var $row = NWF$(this);
var rownumb = NWF$('.rows input').val();
var collection = {};

NWF$(".your-repeater .nf-repeater-row:not('.nf-repeater-row-hidden')").each(function (){
var $migrationfield = $row.find(".migrationfield input").val();
for(var i=0;i<rownumb;i++){
collection[i] = new NF.PeoplePickerApi('#' +peoplepicker);
collection[i].search($migrationfield).done(function (data) {
collection[i].add(data[0]);
});
}
});
});
}

The problem it returns in the dev-mode is following: 

Uncaught TypeError: cannot read property 'add' of undefined.

 

So I clearly see that the add method does not work, but why not? Any Suggestions?

Outcomes