I am trying to build an array of the ID's of the users in a peoplePicker Field by using push.
So far I'm not having much luck as I'm getting this error:
"Uncaught TypeError: visitorIDs.push is not a function".
My code is below.
I appreciate any suggestions/pointers:
// Get information about all users.
var users = peoplePickerVisitors.GetAllUserInfo();
var userInfo = '';
for (var i = 0; i < users.length; i++) {
var user = users[i];
for (var userProperty in user) {
userInfo += userProperty + ': ' + user[userProperty] + '<br>';
}
}
var userloginbase = users[0].Key;
var userlogin = userloginbase.split("\\");
var context = SP.ClientContext.get_current();
var newUser = context.get_web().ensureUser('xxxxxxx\\' + userlogin[1]);
context.load(newUser);
context.executeQueryAsync(function () {
},
function (sender, args) {
});
// pause for a second to let the async ensure user complete.
setTimeout(function() {
getAssignedToUserIdByEmail(users[0].EntityData.Email);
visitorIDs = ResolvedToUser.Id;
visitorIDs.push(ResolvedToUser.Id);
}, 100);
};