Quantcast
Viewing all articles
Browse latest Browse all 6517

New Post: SPUpdateMultipleListItems dynamic query and value?

I am attempting to use SPUpdateMultipleListItems to update the "Date Completed" field of all sub tasks that are connected to a parent task through a lookup column.  My code is designed so it generates a query dynamically, as well as setting the value to match one entered on the parent Task.

The code currently checks to see if the Parent Task Date Completed Field holds a value.  If it does, it then grabs the ID of the Parent Task (from the URL), and then is suppose to build a CAML Query to identify what subtasks to update based on the Parent Task ID (matching the SubTask's Lookup).  It then uses the value of the Parent Task's "Date Completed" field to put into the "Date Completed" field of each of it's Sub Tasks.

I don't know if this is actually possible to do with SPServices, but I do not run into any errors when I test my code, and the debug and Complete Function of SPUpdateMultipleListItems don't show indicators either.  Any thoughts on why my code isn't working?

Here is the code described above without the if else statement I am using.

var dateComp = $('h3:contains("Date Completed")').closest('td').next('td').text();var queryStringVals = $().SPServices.SPGetQueryString();var taskID = queryStringVals["ID"];var query = "\"<Query><Where><Eq><FieldRef Name='bscParentTask' LookupId='TRUE'/><Value Type ='Lookup'>"+ taskID +"</Value></Eq></Where></Query>\"";var value = "[[\"Date Completed\", \"" + dateComp + "\"]]"

$().SPServices.SPUpdateMultipleListItems({
listName: "{D8D7FC23-4B16-4D80-AF04-7894392A99EF}",
CAMLQuery: query,
valuepairs: value,
}); 

In the query I am using the static (internal) field name, but in my value pairs I have tried both the static field name, and display. Neither seems to work for me.  Any thoughts?


Viewing all articles
Browse latest Browse all 6517

Trending Articles