I am trying to use a client context and load in userproperties and a list in the same success method. However I am having a problem as I get an error saying my listitems are undefined. Here is my code :
NBSProfileInfo.NewsPersonalisation = (function () {
var MyProperties,
getMyNewsChoices = function () {
// Get the current client context and PeopleManager instance.
var clientContext = SP.ClientContext.get_current();
var peopleManager = new SP.UserProfiles.PeopleManager(clientContext);
// Get user properties for the target user.
// To get the PersonProperties object for the current user, use the
// getMyProperties method.
MyProperties = peopleManager.getMyProperties();
// Load the PersonProperties object and send the request.
clientContext.load(MyProperties);
var editablePropertiesList = clientContext.get_site().get_rootWeb().get_lists().getByTitle('EditableProperties'),
camlQueryEP = new SP.CamlQuery(),
collListItemsEP;
collListItemsEP = editablePropertiesList.getItems(camlQueryEP);
clientContext.load(collListItemsEP);
clientContext.executeQueryAsync(getMyNewsChoicesSuccess, getMyNewsChoicesFail);
},
getMyNewsChoicesSuccess = function () {
var listItemEnumeratorlistReadyEP = collListItemsEP.getEnumerator(),
countEP = collListItemsEP.get_count(),
EPItem;
var listTitle = [];
while (listItemEnumeratorlistReadyEP.moveNext()) {
EPItem = listItemEnumeratorlistReadyEP.get_current();
listTitle.push(footerListItem.get_item('Title'));
}
this is the part of my code that is not working it says collListItemsEP
is undefined
How can I make it so I can use them in the same success method. Or at least be able to use the output of my list into the success method of the user properties people manager.
var listItemEnumeratorlistReadyEP = collListItemsEP.getEnumerator()