Skip to main content
Nintex Community Menu Bar

how do I get the user account login id from a lookup column people field?

  • Sep 19, 2017 11:10 AM UTC
  • 2 replies
  • 92 views
  • Translate All

Forum|alt.badge.img+1

If I do a lookup() to another list to retrieve a Person field - in this case branch manager, I get a value

4661#;John Doe

How do I get the account name etc to set a people picker field on the form?

2 replies

Forum|alt.badge.img+9
  • Sep 19, 2017 12:26 PM UTC

Set "Show field" attribute to "Account" in SharePoint list column settings for the Person field to get account by lookup function.

If You need also Name attribute in SharePoint list, You can create a list workflow to set one field based on the value of the other field when item is created or modified.

Translate

Forum|alt.badge.img+1
  • Author
  • Sep 20, 2017 8:50 AM UTC

So I tried that - and it does work - however for some reason it looks like no value is returned for users who have not signed into the site collection. So I ended up using the SP REST API to load the data

NWF$.ajax({
        url: url + "/_api/web/lists/getbytitle('" + listname + "')/items(" + id + ")",
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function(data) {
            // Returning the results
            var person = data.d.BranchManager;
            var obj = JSON.parse(person);

            var ins = new NF.PeoplePickerApi('#' + peoplePickerCntrl);
           
            ins.search(obj.ID).done(function(data) {
                ins.clear();
                ins.add(data[0]);

            });
        },
        error: function(data) {
            alert("Failed");
        }
    });
Translate