Having issues with SPUpdateMultipleListItems

Mar 11 at 5:48 PM
Edited Mar 14 at 10:54 PM
Hey Marc and guys,

I'm trying to get the following to work in an O365 environment. I want to get the input of 3 existing fields. I'll use 1 field for reference in the CAML query and the other two to update to items in the list and have it kick off when the user saves the info in the edit form:
<script type="text/javascript">
$(document).ready(function() {

$("input[name$='SaveItem']").click(function(){

    var Num = $("input[id*=Number]");
    var Top = $("input[id*=Top]");
    var OrderQuantity = $("input[id*=OrderQuantity]");

    $().SPServices.SPUpdateMultipleListItems(
    {
    webURL: "https://test.sharepoint.com/test",
    listName: "List GUID",  
    CAMLQuery: "<Query><Where><Eq><FieldRef Name='Top' /><Value Type='Text'>Top.val()</Value></Eq></Where></Query>",    
    batchCmd: "Update",
    valuepairs: [["Number", Num.val()], ["Order Quantity", OrderQuantity.val()]],
    debug: false
    });
});
</script>
Does anything seem out of place to you?

Edit: I've checked the CAML query via U2U CAML Builder on the site, tried different columns in the value pairs, and tried both the list name and the list GUID
Mar 14 at 6:30 PM
Still having issues with this. I've tried updating different fields,but its' not working.
Coordinator
Mar 16 at 7:57 PM
Because of where you have the parentheses in your CAML, this won't work:
   CAMLQuery: "<Query><Where><Eq><FieldRef Name='Top' /><Value Type='Text'>Top.val()</Value></Eq></Where></Query>", 
Try
   CAMLQuery: "<Query><Where><Eq><FieldRef Name='Top' /><Value Type='Text'>" + Top.val() + "</Value></Eq></Where></Query>", 
M.
Mar 16 at 7:59 PM
Okay. So in any case do you know how can retrieve the versions of a list items. I tied web service too but it also comes under CORs.
Mar 23 at 6:28 PM
Marc,

Thanks for the reply,

so I changed that line and it's still not working for me. Let me ask if it's even possible in the scenario i'm trying to use it in: In the Edit form of a list I want to update one list item and then have SPUpdateMultipleListItems to update the rest of the list items that match the Top field when the user hits the Save button on the Edit form. Is this how this function works? Below is how I have the code. Thanks again for your help!
<script type="text/javascript">
$(document).ready(function() {

$("input[name$='SaveItem']").click(function(){

    var Num = $("input[id*=Number]");
    var Top = $("input[id*=Top]");
    var OrderQuantity = $("input[id*=OrderQuantity]");

    $().SPServices.SPUpdateMultipleListItems(
    {
    webURL: "https://test.sharepoint.com/test",
    listName: "List GUID",  
    CAMLQuery: "<Query><Where><Eq><FieldRef Name='Top' /><Value Type='Text'>" + Top.val() + "</Value></Eq></Where></Query>",    
    batchCmd: "Update",
    valuepairs: [["Number", Num.val()], ["Order Quantity", OrderQuantity.val()]],
    debug: false
    });
});
</script>