none
Populating people picker fields based on values in another people picker field RRS feed

  • Question

  • Hello,

    I'm attempting to create a form which will allow my users to pick the name of their team leader in a people picker field and, based off of their selection, auto populate the name of their supervisor & manager (also in people picker fields).

    I'm using infopath to design my forms and I can't seem to figure out how to create the correct relationship. Could someone assist?

    Tuesday, September 3, 2019 8:26 PM

All replies

  • Below JavaScript should does the trick for you. Just Change the Variables of PeoplePicker1 & PeoplePicker2 according to your field names.

    <script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script> 
    <script type="text/javascript" language="javascript">
    NWF$(document).ready(function () {
        var firstPPPickerFieldl = NWF$('#' + var_PeoplePicker1);
        var secondPPPickerField = new NF.PeoplePickerApi('#' + var_PeoplePicker2);
        NWF$(firstPPPickerField).change(function () {
            secondPPPickerField.search(NWF$(firstPPPickerField).val()).done(function (data) {
                secondPPPickerField.add(data[0]);
            });
        });
    });‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
    </script>
    Thanks & Regards,


    sharath aluri


    Wednesday, September 4, 2019 12:58 AM
  • Hi JoeCamb,

    In InfoPath  form, you need to define DisplayName, AccountId and AccountType for the Manager people picker in the Form Load rule.

    More information check the article below: InfoPath: Pre-populate the People Picker

    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.

    Best regards,

    Grace Wang


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, September 4, 2019 7:37 AM