SPUpdateMultipleListItems Unable to update a specific list

Feb 14, 2013 at 1:31 PM
I have a problem with a specific list not updating the items. I am able to run getlistitems on the same list.

I have tried guid and name for listname as it has a space in it.

This code below works on other lists by just changing the listname and field\values. Also, When I run this the status comes back as success.

Any suggestions as to where to look would be appreciated.

$(document).ready(function () {
    $().SPServices.SPUpdateMultipleListItems({
        listName: "{76B86750-1A68-44E7-93FF-823A1D7AA500}",
        CAMLQuery: "<Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>Analytics</Value></Eq></Where></Query>",
        valuepairs: [["GoogleUA", "Frank"]],
        completefunc: function (xData, Status) {
            alert("Updated " + Status + xData);
        }
    });

});
Coordinator
Feb 14, 2013 at 5:18 PM
Probably the best next step would be to look at the network traffic with either Firebug or Fiddler to see what issue might be occurring. Success only indicates that the .ajax() call got a response from the server. That response may well contain an error.

M.
Feb 14, 2013 at 5:22 PM

I tried to output the error. But I could not glean anything useful out of the output-error. I will try fiddler and see what that tells me.

Thank you,

Frank Cardillo

404-652-4030

From: sympmarc [email removed]
Sent: Thursday, February 14, 2013 12:18 PM
To: Cardillo, Frank F.
Subject: Re: SPUpdateMultipleListItems Unable to update a specific list [SPServices:433140]

From: sympmarc

Probably the best next step would be to look at the network traffic with either Firebug or Fiddler to see what issue might be occurring. Success only indicates that the .ajax() call got a response from the server. That response may well contain an error.

M.

Coordinator
Feb 14, 2013 at 5:24 PM
You can also alert xData.responseText, but sometimes it's hard to read in an alert box.

M.
Feb 14, 2013 at 6:52 PM
Does your list contain folders? Do the folders have different permissions than the list itself? I will explain my madness. I have a list with folders. All users had read permission at the top level of the list but I didn't want them creating/editing items at the top level. I wanted them to create/edit within the folders only. So, at each folder level, I assigned contribute permission for the appropriate groups of users. All worked well through the SP user interface (users could only work on content within their assigned folders). Now, SPUpdateMultipleListItems operates at the list level. So, when my users were running an event that required the SPUpdateMultipleListItems method, all indications were fine from a code trace process but the reality was, the update wasn't occurring because the users didn't have contribute permission at the top level. As soon as I changed that permission, everything worked fine. Also, the operation still respects the permissions set within the individual folders. For instance, if a user has permission on folder "A" but not folder "B" and each folder contains an item with a Title of "Analytics", that user could run the SPUpdateMultipleListItems per your code/query above and it would not touch the item in folder "B." However, if the user doesn't have edit permission at the list level, they update nothing, regardless of the folder permissions.

Geoff
Coordinator
Feb 14, 2013 at 6:59 PM
Goeff is right. All SPUpdateMultipleListItems does is first call GetListItems and then UpdateListItems on that set of items. Each user will only retrieve the items they are allowed to read in the first step and update only the ones they can update in the second.

Permissions always apply.

M.
Feb 14, 2013 at 7:05 PM

I started looking at permissions as well. At the beginning of my tests it did have custom security. I am now inheriting from the site. There are no folders. It’s a Simple configuration list.

Currently:

Code:

$(document).ready(function () {

$().SPServices.SPUpdateMultipleListItems({

listName: "y_MGT_Site Specifics",

CAMLQuery: "<Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>Analytics</Value></Eq></Where></Query>",

valuepairs: [["GoogleUA", "Frank"]],

completefunc: function (xData, Status) {

alert("Updated " + Status + xData);

}

});

});

Thank you,

Frank Cardillo

404-652-4030

From: sympmarc [email removed]
Sent: Thursday, February 14, 2013 1:59 PM
To: Cardillo, Frank F.
Subject: Re: SPUpdateMultipleListItems Unable to update a specific list [SPServices:433140]

From: sympmarc

Goeff is right. All SPUpdateMultipleListItems does is first call GetListItems and then UpdateListItems on that set of items. Each user will only retrieve the items they are allowed to read in the first step and update only the ones they can update in the second.

Permissions always apply.

M.

Feb 15, 2013 at 12:49 PM
I got it working. It was not the code the list has a bad row in it. I deleted it and then recreated it and the code works as intended. Hopefully it was just my local version of the list. Do you know where any examples are o n the web of someone using spservices to populate a an html form?

Thanks again for the help.
Frank
Coordinator
Feb 15, 2013 at 4:32 PM
Frank:

I'm curious what the "bad row" was. Can you explain?

You can certainly use SPServices to get data that you can use to populate a form. What specficially are you trying to do? It may be that you really need some jQuery, not SPServices.

M.
Feb 15, 2013 at 5:19 PM

I am not sure what was wrong with the bad row. Thru trial and error I discovered that only one row was not updateable. I removed the row and recreated it and it works fine. I am building an application page that updates a custom site settings list. Just trying to make it a little more intuitive for the user rather than them having to update a list. When I say form, Its really just some HTML controls like a radio button and drop down list.

Thanks

Frank

From: sympmarc [email removed]
Sent: Friday, February 15, 2013 11:32 AM
To: Cardillo, Frank F.
Subject: Re: SPUpdateMultipleListItems Unable to update a specific list [SPServices:433140]

From: sympmarc

Frank:

I'm curious what the "bad row" was. Can you explain?

You can certainly use SPServices to get data that you can use to populate a form. What specficially are you trying to do? It may be that you really need some jQuery, not SPServices.

M.

Coordinator
Feb 15, 2013 at 5:33 PM
Got it. Sometimes odd things happen.

As for populating the form, you can pull the info from a list using GetListItems and the populate the HTML elements with the values.

For instance, to populate an input field, you'd use:
$("input[id='your_id']").val(your_value);
M.