Hi!
If you are using Nintex Responsive Forms, then unfortunately this is not yet possible - you cannot set a rule on the people picker field for "Set Value". Sorry.
If, however, you are working with Standard Forms, then the easiest way is to use the NF.PeoplePickerApi (People Picker Extensions - Nintex Forms) and then to write a javascript, that sets the other field value once the value in the first place changes, ex.:
NWF$(document).ready(function () {
var firstPPPickerFieldl = NWF$('#' + var_People1);
var secondPPPickerField = new NF.PeoplePickerApi('#' + var_People2);
NWF$(firstPPPickerField).change(function () {
secondPPPickerField.search(NWF$(firstPPPickerField).val()).done(function (data) {
secondPPPickerField.add(dataa0]);
});
});
});
The var_People1 and var_People2 are the JavaScript variables of the PP 1st and 2nd control.
I haven't tested this particular script, but imo it should work, or at least point to the correct solution
Regards,
Tomasz
Hi TC N ,
This is something working code for your requirement in on Prem, not sure if people picker extensions available in O365 or not.
NWF.FormFiller.Events.RegisterAfterReady(function () {
var _personName = new NF.PeoplePickerApi("#" + varRequestorName);
_personName.added(function () {
var _txtUserID = NWF$("#" + varRequestorName).val();
_txtUserID = _txtUserID.replace(/;/, ""); //THIS IS IMPORTANT
var _SecondpersonName = new NF.PeoplePickerApi("#" + varCreatedFor);
_SecondpersonName.search(_txtUserID).done(function (data) {
_SecondpersonName.add(datan0]);
});
}); // End of added function
_personName.removed(function () {
var _SecondpersonName = new NF.PeoplePickerApi("#" + varCreatedFor);
_SecondpersonName.clear();
}); // end of removed function
});
as there is no change function available for people picker control you have to make use of added & removed methods as per the documentation mentioned in Tomasz Poszytek 's reply
Hi Tomasz!
Thank you for your response.
I have tried your solution but nothing happens.
Hi Jaya!
Thank you for your response.
I am in O365, I tried your solution but sadly, nothing happens.
Honestly speaking it seems that the NF.PeoplePickerAPI is not present in the Office 365. I checked that object and there is no such node.
Anyway, I have other solution for you. Tested and working. Use the following code:
NWF.FormFiller.Events.RegisterAfterReady(function () {
NWF$(document).ready(function() {
NWF$("#"+var_People1).change(function() {
NWF$("#"+var_People2).val("");
NWF$("#"+var_People2).closest("div.ip-container").find("div.ip-item").each(function() { NWF$(this).remove(); });
NWF$("#"+var_People2).val(NWF$(this).val());
NWF$(this).closest("div.ip-container").find("div.ip-item").each(function() { NWF$("#"+var_People2).closest("div").find("textarea").before(NWF$(this).clone(true,true)); });
});
});
});
Obviously the var_People1 and var_People2 are JavaScript variables set for you two fields:
Bon appetit!
Regards,
Tomasz
This worked perfectly! Thank you so much, Tomasz!
I'm glad to hear that Good luck in Nintexing
Regards,
Tomasz
Hi Tomasz,
Thanks for your suggestion!
In my case I want to prepopulate People control of Nintex form (o365) classic form based on users email address.
I have user id and user email address in my javascript.
now using these 2 values I want to populate the people control in nintex form.
Hi Mate
Can we populate manager of first people picker to the second one ?
This is not working on my form. Could you please help me out?