This project has moved. For the latest updates, please go here.

Storing in new List. Can it be empty to begin with?

Jul 21, 2015 at 2:11 PM
I suppose the answer should be yes, but things don't appear to be working. I have this code for storing into a new list, i.e. it currently has no entries in it:
function storeNewUserData(valuePairs) {

        operation: "UpdateListItems",
        async: false,
        batchCmd: "New",
        listName: "FunctionalBillet",
        valuepairs: valuePairs,
        completefunc: function (xData, Status) {
            console.log("Status: " + Status);
            if (Status == "error") {
                console.log ("Unable to communicate with Sharepoint Server.  Please try again at a later time.");
Here is some data I am trying to store:
 storeNewUserData valuePairs[0]: Title,DEWELLMM 
 storeNewUserData valuePairs[1]: BillNumber,0000525 
 storeNewUserData valuePairs[2]: LastName,Dewell 
 storeNewUserData valuePairs[3]: FirstName,Matthew 
 storeNewUserData valuePairs[4]: MiddleInitial,M 

It says success as to the console.log("Status: " + Status), but nothing shows up in the list. Note, I still have not made any entries in the list, but I figured it should work fine without anything in the list. Please give some thoughts on this. I have had several SPServices functions work fine before with this routine.

Jul 21, 2015 at 2:40 PM
Success just means that the communication with the server was successful, not that the write was successful. You should look at xData.responseText or the nextwork traffic in the browser tools to see what's coming back in the response. Odds are you have an invalid field name or value in there somewhere.

What I usually do is start with just writing the Title. It's just text and every item in every list has it. Then start adding in the other columns as you go.

Marked as answer by trout0525 on 7/21/2015 at 12:56 PM
Jul 21, 2015 at 7:57 PM
Thanks for the xData.responseText debugging reference. That helped me find where it was messing up. It was a Date field being formatted correctly.