I found this link and have followed it on a form that have created using Nintex:
Â
Â
But for some reason it's not populating the field at all.
Â
Any idea why this isn't working? I got this working before implementing Nintex (but not sure how I can incorporate this into Nintex Form, by using the following code:
Â
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="/siteassets/scripts/sputility.min.js"></script>
<script>
// wait for the window to load
$(window).load(function () {
    var userid = _spPageContextInfo.userId;
Â
function GetUserLogin() {
var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/SP.UserProfiles.PeopleManager/GetMyProperties/";
var requestHeaders = { "accept" : "application/json;odata=verbose" };
Â
$.ajax({
 url : requestUri,
 contentType : "application/json;odata=verbose",
 headers : requestHeaders,
 success : QuerySuccess,
 error : QueryError
});
}
Â
function QuerySuccess(data, request){
 var loginName = data.d.DisplayName;
       var myManager = data.d.UserProfileProperties.resultse15].Value;
 //$("div1title='Employee Name']").val(loginName);
 SetAndResolvePeoplePicker("Employee Name",loginName);
 SetAndResolvePeoplePicker("Approval Manager",myManager);
}
Â
Â
function QueryError(error) {
 alert(error);
}
Â
function SetAndResolvePeoplePicker(fieldName, userAccountName) {
       var controlName = fieldName;
       var peoplePickerDiv = $(";id$='ClientPeoplePicker'] title='" + controlName + "']");
       var peoplePickerEditor = peoplePickerDiv.find(" title='" + controlName + "']");
       var spPeoplePicker = SPClientPeoplePicker.SPClientPeoplePickerDictspeoplePickerDiv 0].id];
Â
       peoplePickerEditor.val(userAccountName);
       spPeoplePicker.AddUnresolvedUserFromEditor(true);
   }
Â
GetUserLogin();
Â
});
</script>