SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Need some assistance on a bit of JQuery for writing to a MOSS 2007 list. I have the following spot of code. If I run it with just the title field, it works fine, adding additional fields doesn't work. The alert note at the bottom shows Status as success and the newID is undefined.

    operation: "UpdateListItems",
    async: false,
    listName: "Arrest",
    updates: "<Batch OnError='Continue' PreCalc='TRUE'>" +
                "<Method ID='1' Cmd='New'>" +
                    "<Field Name='Title'>" + title + "</Field>" +
                    "<Field Name='Date_x0020_of_x0020_Arrest'>" + dateOfArrest + "</Field>" +
                    "<Field Name='Subject_x0020_Information'>" + subjectInfo + "</Field>" +
                    "<Field Name='Charges'>" + charges+ "</Field>" +
                    "<Field Name='Significant_x0020_Activity'>" + sigAct + "</Field>" +
                "</Method>" +
    completefunc: function (xData, Status) {
        //get the ID for the newly created Issue
        var newID = $(xData.responseXML).find("[nodeName=z:row]").attr("ows_ID");
        alert(Status + " " + newID);

Date of Arrest is a date field
Subject Information is a multiline note
Charges is a chouce field
Significant Activity is a lookup, and I'm sending it the ID of the item to lookup to.


share|improve this question
I think that James' suggestion is the solution for this issue. Also, check my blog post about the z:row notation: – Marc D Anderson Feb 9 '11 at 18:53
up vote 2 down vote accepted

What's the format of the Date of Arrest string? I needs to be in ISO8601 format, like 2011-02-08T16:42Z (from what I remember) to be added to the list this way, otherwise the whole add operation fails.

share|improve this answer
Ahhh... is there is a SPService util for converting a date into this format? Ot an easy way with JQuery? – David Lozzi Feb 8 '11 at 21:51
Where's it coming from in the first place? Not sure of a method out in the wild, but you could probably do it with some JavaScript jiggery-pokery. – James Love Feb 8 '11 at 22:00
Test it with a sample date in that format (hard-coded) first, though, to see if I'm right or wrong. – James Love Feb 8 '11 at 22:00
(third comment! :O ) Just found this linked on a thread in StackOverflow, a Date library! has a toISOString() method: – James Love Feb 8 '11 at 22:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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