I am attempting to retrieve the columns from a single item. For whatever reason I am having troubles getting 2 columns from my list. columns (last and next)

request failed Column 'Last' does not exist. It may have been deleted by another user. /sites/mysite/quotes/list/autoquotenumbertest. undefined

enter image description here

Currently I'm just trying to alert the columns so I know they are retrieved. But what I would really like to do is set the column Last = Next once my form is saved successfully.

What am I doing wrong? The other columns are retrieve no problem. Code i'm using:

function AutoGenerate() {
     var targetListItem;
     clientContext = new SP.ClientContext.get_current();
     web = clientContext.get_web();
     var list = web.get_lists().getById(_spPageContextInfo.pageListId);
     var camlQuery = new SP.CamlQuery();
     this.listItems = list.getItems(camlQuery);
     clientContext.executeQueryAsync(Function.createDelegate(this, this.onListItemsLoadSuccess),
         Function.createDelegate(this, this.onQueryFailed));
 function onListItemsLoadSuccess(sender, args) {
     var itemId = 1;  
     var clientContext = new SP.ClientContext(); 
     var targetList = clientContext.get_web().get_lists().getByTitle('AutoQuoteNumberTest');
     targetListItem = targetList.getItemById(itemId);
     clientContext.load(targetListItem, 'NextQuoteNumber','Title','ID','Modified','Last','Next');
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));

  function onQuerySucceeded() {
     var AutoIncremental = targetListItem.get_item('NextQuoteNumber');
     var lastnumber = targetListItem.get_item('Last');
     var nextnumber = targetListItem.get_item('Next');
     $("input[title^='Quote Number']").val(AutoIncremental);
     $("input[title^='Quote Number']").attr('disabled', 'disabled');
 function onQueryFailed(sender, args) {
     alert('request failed ' + args.get_message() + '\n' + args.get_stackTrace());


  • 1
    Last is probably not the internal name of the column. Check that and adjust your query to use the internal name instead. Jul 13, 2022 at 16:52
  • Try clientContext.load(targetListItem) (i.e. without specifying column names manually) and see if you are getting these two columns. Also check what is the internal name of these columns. Jul 13, 2022 at 16:53
  • That was exactly right. The 'internal name' was different. Do you have thoughts on how I would add a function to update the column last to next? I'm not sure what the code would be do accomplish this. I would only want to update the item on submission.
    – Tyler
    Jul 13, 2022 at 17:05

1 Answer 1


To help you better, are you trying to make column Last = column Next ?

If yes, you can try to use the following code:

    var oListItems, clientContext;
function UpdateListItem() {
    clientContext = new SP.ClientContext();
    var oWeb = clientContext.get_web();
    // Specify list title here
    var oList = oWeb.get_lists().getByTitle("<ListName>");
    // Get Item using CAML Query
    var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name=\'Title\'/>' + '<Value Type=\'Text\'>aa</Value></Eq></Where></Query></View>');
    oListItems = oList.getItems(camlQuery);
    clientContext.load(oListItems, 'Include(Last,Next)');
    // Execute the query to the server.
    clientContext.executeQueryAsync(onsuccess, onfailed);
function onsuccess() {

    var oEnumerator = oListItems.getEnumerator();
    while (oEnumerator.moveNext()) {
        var NextItem = oEnumerator.get_current().get_item('Next');

    // Get list item count of the items to be updated
    var itemCount = oListItems.get_count();
    for (var i = 0; i <= itemCount - 1; i++) {
        var oListItem = oListItems.itemAt(i);
        oListItem.set_item("Last",NextItem );
    //Execute the batch
    clientContext.executeQueryAsync(FinalQuerySuccess, FinalQueryFailure);
function onfailed(sender, args) {
    console.log('Failed' + args.get_message() + '\n' + args.get_stackTrace());
function FinalQuerySuccess(sender, args) {
function FinalQueryFailure(sender, args) {
    console.log('Failed' + args.get_message() + '\n' + args.get_stackTrace());

My Test result:

Before:enter image description hereAfter:enter image description here


If the answer is helpful, please click "√" on the left panel of the answer and kindly upvote it.

  • Do you have any further questions about this thread? If you have any questions or progress, you can contact me in time.
    – Zella_msft
    Jul 19, 2022 at 8:13

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.