0

I have two people pickers in a list. I use the following snippet, to insert the current user into the people picker:

var peoplePickerDiv = $("[id$='ClientPeoplePicker'][title='" + fieldName + "']");    
var peoplePickerEditor = peoplePickerDiv.find("[title='" + fieldName + "']");
var peoplePickerId = peoplePickerDiv.attr('id');
var peoplePickerObject = SPClientPeoplePicker.SPClientPeoplePickerDict[peoplePickerId]; 

peoplePickerEditor.val(userAccountName);
peoplePickerObject.AddUnresolvedUserFromEditor(true);

It works great in IE11. In Firefox however, it only puts the name into the first field but not completely resolves it (it is underlined red as when the Spellcheck is active) and the second people picker doesn't get touched at all.

But then I do this step by step in the debugger (using F11), it works like a charme.

Any suggestions?

  • Have you tried to add a short timer between the peoplePickerEditor.val(userAccountName); and peoplePickerObject.AddUnresolvedUserFromEditor(true); and/or before/after those? You could give it a shot. – moe Jul 9 '15 at 9:24
  • that actually worked. Sometimes it worked with a timeout of 100ms, sometimes I needed 500ms. Strange. Thank you. – Södy Jul 9 '15 at 9:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.