cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Update control field in form, with data from SharePoint list

Hi all. I have a Nintex form that has two fields, "Employee", and "Employee number". A also have a SharePoint list with two columns, "User", and "User number". The fields "Employee" and "User" are both People pickers.

My wish is that if i open the Nintex form and set a person in the Employee, the form will get the field "Employee number" updated with the data that is stored in the other SharePoint lists column "User number". I dont know if i should use a workflow, or a List lookup, i have tried both ways, but nothing seems to help.

I have made a rather primitive drawing, in order to help you to understand my needs.

Thanks in advance.

/Frank

Denmark

Nintex.PNG

Tags (1)
0 Kudos
Reply
6 Replies
Automation Master
Automation Master

Re: Update control field in form, with data from SharePoint list

yes, it's workable.

I was able to achieve that following way.

- placed PP control to let choose employee

- placed single line text control on the form, that will hold emplyee's display name

- added following piece of code to form settings. it populates employye's display name into text control after every employee selection change

NWF.FormFiller.Events.RegisterAfterReady(function () {

  NWF$('#'+ppctrl).change(function(){

      var PPobj = new NF.PeoplePickerApi("#"+ppctrl);

        PPobj.search(NWF$('#' + ppctrl).val().replace(";","")).done(function(data) {

          NWF$('#'+userLookupString).val(data[0].label);

          NWF$('#'+userLookupString).focusout();

        })

  })

})

-added calculated control with formula: lookup("L1_lookup","pp",userLookupString,"num")

so it looks to 'pp' column in L1_lookup list, search for employee's display name and return value from column 'num'

note that if you are on at least SP standard and have available user profile service available you might simplify that and instead of writting javascript code you can use userProfileLookup() function to get employee's display name

Reply
Not applicable

Re: Update control field in form, with data from SharePoint list

Thank you very much for a quick reply. I am using the User profile Lookup to get the users display name, and other data from the user profil, but there is no data there about the employee number, so i needed a way to get it from a list instead. I will try this out.

0 Kudos
Reply
Not applicable

Re: Update control field in form, with data from SharePoint list

Just a silly question. In my form i have three people picker controls, but it is only one of them, that i have to use to do the lookup. How can I in the java script make sure that it only looks at the correct people picker?

/Frank

0 Kudos
Reply
Automation Master
Automation Master

Re: Update control field in form, with data from SharePoint list

what do you in fact mean with 'employee number'?

is it an ID that sharepoint assigns to a user object?

0 Kudos
Reply
Automation Master
Automation Master

Re: Update control field in form, with data from SharePoint list

in order you can work with any control from within javascript you have to assign it javascript variable. that will uniquely identify every single control on your form.

0 Kudos
Reply
Automation Master
Automation Master

Re: Update control field in form, with data from SharePoint list

Hi ‌, did you resolve this issue?

could it be closed?

0 Kudos
Reply