cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

set peoplepicker to user other than current user

Jump to solution

I am trying to set a people picker control to a user other than the current user. I have read the 1222 post and am unable to get that to work: https://community.nintex.com/docs/DOC-1222

I put this function in my custom JavaScript:

function setToPrimay() {

 var ins = new NF.PeoplePickerApi('#' + 'cidRep');
 ins.search('i:0#.w|xxx\userID').done(function (data) {
  ins.add(data[0]);
}

The people picker Client ID JavaScript variable name is: cidRep.

The button has a client click of: NWF.FormFiller.Events.RegisterAfterReady(function () { setToPrimay(); });

(Of course I changed the domain and user ID above)

I also tried setting the people picker with no luck: NWF$("#"+cidRep).val('i:0#.w|xxx\userID');

Thanks for any assistance,

John

0 Kudos
Reply
5 Replies
Workflow Hero

Re: set peoplepicker to user other than current user

Jump to solution

- remove apostrophes from around cidRep javascript variable

- configure button click just to: setToPrimary();

0 Kudos
Reply
Workflow Hero

Re: set peoplepicker to user other than current user

Jump to solution

Thank you for your response Marian, I really appreciate it!

I have updated the JS code, removing the quotes around the people picker client ID and striped the client click down to just the function call and a semi colon. I also put a line in to test for the ins object but I never even got an alert popup and the people picker didn't get populated. If I manually paste the same i:0#w|xxx/userID in the people picker the user comes up.

Reply
Workflow Hero

Re: set peoplepicker to user other than current user

Jump to solution

I just noticed a typo in the function name. I updated that and still am not getting the people picker populated.

Updated function:

function setToPrimary() { 
   var ins = new NF.PeoplePickerApi('#' + cidRep);
   ins.search('i:0#.w|xxx\userID').done(function (data) {
      ins.add(data[0]);
   }
}

Reply
Workflow Hero

Re: set peoplepicker to user other than current user

Jump to solution

try with user identifier as follows

i:0#w|xxx\\userID

Reply
Workflow Hero

Re: set peoplepicker to user other than current user

Jump to solution

I also had a missing closing paran, but you got me there. Thanks a ton Marian!

function setToPrimary() {
   var ins = new NF.PeoplePickerApi('#' + cidRep);
   ins.search('i:0#.w|xxx\\userID').done(function (data) {
      ins.add(data[0]);
   })<-----
}

Reply