Sunday, March 11, 2018

How to auto populate a people picker field based on another people picker field?

Refer the below link for details:
https://community.nintex.com/thread/17850-how-to-auto-populate-a-people-picker-field-based-on-another-people-picker-field
NWF.FormFiller.Events.RegisterAfterReady(function () { 
     NWF$(document).ready(function() {
          NWF$("#"+var_People1).change(function() {
               // first wipe out existing state of the field
               NWF$("#"+var_People2).val("");
               NWF$("#"+var_People2).closest("div.ip-container").find("div.ip-item").each(function() { NWF$(this).remove(); });
               // then fill it with the scope set in field 1
               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)); });
          });
    });
});