I have this code that I always use to query and display items, but I need to perform occasional updates as well and tried this code.

It wouldn't update or recognize the word update. I tried a number of ways but this is where I am now:

function getListUP() {
 try {
        var clientContext = new SP.ClientContext.get_current();
        var web = clientContext .get_web();
        var list = web.get_lists().getByTitle('TestList');
        var query = '<View Scope=\'RecursiveAll\'>'+
                                 '<FieldRef Name=\'ID\'/>' + 
                                 '<Value Type=\'Text\'>'+ itemID +'</Value>'+

        var camlQuery = new SP.CamlQuery();
        this.listItems = list.getItems(camlQuery);
        clientContext.executeQueryAsync(Function.createDelegate(this, this.querysuccessN), Function.createDelegate(this, this.onQueryFailed));
catch (e) {
function querysuccessN() 
var listItemInfo = '';
    var listItemEnumeratorN = listItems.getEnumerator();

 while (listItemEnumeratorN.moveNext()) 
     var oListItem = listItemEnumeratorN.get_current();
     var Reg = oListItem.get_item('Title');
     var Reg1 = oListItem.get_item('Status');
     if(Reg1 == 'Open'){
     this.set_item('Status', 2);
     alert("Update Success");}

It passes through to the 3rd alert and sometimes gets the success but it never actually updates the list with the information I want.

I just want to change a dropdown item to go from Open to Reviewed or In-Progress on a single record.

1 Answer 1


Why do you call:

this.set_item('Status', 2);

instead of:

oListItem.set_item('Status', 2);

Also, why do you call:


instead of:


And also: don't use the Id of the choice value you want, but directly the string value. So the set_item call should actually be:

oListItem.set_item('Status', 'Reviewed');
  • I tried both and neither worked real well. It was duplicating so I added a delete in the array for each item and each time it was read. However, it still duplicated. So using the this.listItem seemed to solved the multiple items but only for the first 200 records updated. After that it started to duplicate again. Since there were too many issues we changed our whole direction and went to greenplumb and angular Feb 22, 2016 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.