I’m creating list items in a SharePoint (MOSS) list programmatically. I’ve been successful with several different techniques, as long as I limit the number of fields to two. I need to provide 76 field values, actually. Am trying SPServices UpdateListItems method. Latest versions of jQuery (1.7.1) and SPServices (0.7.0).
My first approach was to use the valuepairs option. I have two arrays I can use to feed this. Worked fine for two values. I then tried statically filling variables and using those. Same result. Switched to the CAML Batch method. Same result.
The complete function status is always “Success.” Nothing gets written to the list.
var batch = "<Batch OnError='Continue'><Method ID='1' Cmd='New'>";
batch += "<Field Name='" + varTitle + "'>" + varTitle_val + "</Field>";
batch += "<Field Name='" + varformid + "'>" + varformid_val + "</Field>";
batch += "<Field Name='" + varee1 + "'>Hi!</Field>";
batch += "<Field Name='" + varee2 + "'>there</Field>";
batch += "<Field Name='" + varee3 + "'>how</Field>";
batch += "<Field Name='" + varee4 + "'>are</Field>";
batch += "</Method></Batch>";
$().SPServices({
operation: "UpdateListItems",
batchCmd: "New",
listName: "CRMSAccessRequest",
// valuepairs: [[arFields[0],arValues[0]],[arFields[1],arValues[1]],[arFields [2],arValues[2]]], //fails with more than two fields
// valuepairs: [[varTitle,varTitle_val],[varformid,arValues[1]],[varee1,varee1_val],[varee2,varee2_val]], // ditto
updates: batch,
completefunc: function(xData, Status) {
alert("status of write attempt: " + Status);
}
}); //SPServices
Any suggestions?
The “Success” you are getting back just tells you that there was a successful transaction. You need to look at the returned XML to see what issues there might be.
The easiest way:
alert(xData.responseText);
My guess is that one or more of your field names is incorrect. It’s hard to tell since you are using variables for the column names.