Solved

Unable to get PeoplePickerAPI to work

  • 7 December 2018
  • 1 reply
  • 36 views

I am trying to clear a people picker field (Requester) in a form if another selection is made on a choice field.

 

I've read the other links on using the PeoplePickerAPI and here is my js.

 

NWF.FormFiller.Events.RegisterAfterReady(function () {
   NWF$("#"+varJSRequestType).change(function () {
      clearRequester();
   });
});

 

function clearRequester() {
   if (NWF$("#"+varJSRequestType).val()=="Process OT") {
      alert('Here I am');
      var varPeoplePicker = new NF.PeoplePickerApi('#' + varJSRequester);
      alert('Here I am');
      varPeoplePicker.clear();
      alert('Here I am');
   }
}

 

The code runs fine and I get the first alert, but it seems to fail on defining the varPeoplePicker variable.  It just jumps out of the code.  No errors, but I never get the 2nd or 3rd alerts.

 

Here is the varJSRequester definition on the people picker.

 

221566_pastedImage_1.png

 

Is the PeoplePickerAPI not available for Nintex for Office 365 or is it just not available on our system?  Any way to check that or any other thoughts?

icon

Best answer by jeff_l 17 December 2018, 20:38

View original

1 reply

I couldn't get PeoplePickerAPI to work, but I did essentially found out how to create your own.

Using Tom O'Connor's post at Nintex Forms: Automatically populating the new people picker control - Wow, So SharePoint, Much Information 

I used his NFPeoplePickerWrapper.js file (download available at link above).  I think it is basically the same as PeoplePickerAPI, but if you take that download, save it somewhere on your sharepoint site.  Take the link and on your form go to "Form Settings", "Advanced" and paste the link.  This makes the functionality available on your form. 

Using this, it is called PeoplePickerWrapper rather than PeoplePickerAPI, so replace the PeoplePickerAPI references in the js above with PeoplePickerWrapper and it worked for me.

Reply