I am trying to copy few list item from one SharePoint List to another SharePoint List from a SharePoint Form. Both are identical lists with same Column names and Types, when an item's Status column changes to Completed in List1 workflow will replicate it on List2. Due to few workflow run time errors both Lists are out of sync and more than 1000 such items are missing.

As many of the missing items are Old and no longer required on List2, I was requested to add only few important items that are missing on List2 that are on List1

I have created a SharePoint Form to display the missing List items on the Form in a table with a Checkbox in front of each row. Users can select the row they want to copy to List2 from the table and the Form should add the item to the List2 on button click

So far, I was able to get the missing items on List2 from List1, and display it on the Form in a Table with CheckBox. When user select the CheckBox and Click the Sync button, I was able to get the List item from List1 but not able to add it to List2

Here is the code that is not working

function copyItem(itemNo){
  spListItem{(action: "get", url: formUrl, listname: listName1, itemID: itemNo, success: printSuccess, failure: printFailure)};
  spListItem{(action: "set", url: formUrl, listname: listName2, itemData: itemDatas, success: printSuccess1, failure: printFailure1)};

function printSuccess(data){
  itemDatas = data;
function printSuccess1(data){
function printFailure(data){
function printFailure1(data){

The below line works:

spListItem{(action: "get", url: formUrl, listname: listName1, itemID: itemNo, success: printSuccess, failure: printFailure)};

Along with printSuccess that prints the data fine, but the set line is not working, its ending in Error

A node of type 'EndOfInput' was read from the JSON reader when trying to read the start o an entry. A 'StartObject' node was expected.

Can someone help understand what is wrong in this code and how to fix it?

1 Answer 1


The approach in the question did not work, so I will have to add it by setting array of data to each column of the list:

function createListItem(itemID){
 var c = new SP.ClientContent(siteURL);
 var l = c.get_Web().get_lists().getByTitle(listTitle);
 var inf = new SP.ListItemCreationInformation();
 this.o = l.addItem(inf);
 for(var i = 0; i < dataArray.length; i++){
 c.executeQueryAsync(Function.createDelegate(this, this.onQuerySuccessed), Function.createDelegate(this, this.onQueryFailed)); 

onQuerySuccessed and onQueryFailed are just console.log to print failed/success.

Hope this helps someone someday!

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.