cancel
Showing results for 
Search instead for 
Did you mean: 
jeff_l
Nintex Newbie

Unable to get PeoplePickerAPI to work

Jump to solution

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.

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?

0 Kudos
Reply
1 Reply
jeff_l
Nintex Newbie

Re: Unable to get PeoplePickerAPI to work

Jump to solution

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 Info... 

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.

0 Kudos
Reply