Thanks for your suggestion. 2014-12-15_1506 - JohnLuangco's library
That's something to think about so that the manager doesn't keep getting added when people view or edit a submitted form. My current problem revolves around the manager being added twice on the new form (before it gets submitted).
What about: Put a simple IF condition inside of your function to make sure it only fires once. This could be something as simple as an incremented int value to check against to see if it already fired.
Thanks Mike. I did try to put a catch in there so that it only fires once. However what I found was that the function is called and run at the same time as opposed to running in a linear fashion. Might ask Nintex to see if this approach is supported.
I know this is late, but we have had a very similar issue, and got around it without JS. There are probably caveats around how we did it, but it works, and that's all that matters to me .
It's all around not requiring to have a people picker control to connect to the list item directly, but rather a calculated control calculating the boss name from the people picker control (using userprofileLookup). It is then connected to the text item, and most importantly is that the workflow works on the value in the connected text item.
i know this is a bit of a long shot as it has been a couple of years since you posted this, but your solution is exactly what I am after. Im pretty new Nintex and i have managed to get it to select the current users manager, but I cant work out how to get it to select the manager of the person listed in the other people picker. would anybody be able to help?
Here is how I did it....
var ins = new NF.PeoplePickerApi('#' + peoplecontrol);
var currentuser = NWF$('#' + calculatedvaluecontrol).val();