Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: SPUpdateMultipleListItems dynamic query and value?

$
0
0

Got it!

Ended up NOT building the query and value outside of the SPUpdateMultipleListItems function.  Here is my working code;

$(document).ready(function() {

fields = init_fields_v2();
// Get value from a date fieldvar dateCompleted = getFieldValue('DateCompleted',true);var dateComp = new Date(dateCompleted);var strLength = dateCompleted.length;if ((strLength) > 6)
{var d = dateComp//Generate ISO 8601 date/time formatted stringvar s = "";
  s += d.getYear() + "-";
  s += d.getMonth() + 1 + "-";
  s += d.getDate();
  s += "T" + d.getHours() + ":";
  s += d.getMinutes() + ":";//Replace the "Z" below with the required//time zone offset (eg "+10:00" - Australian EST)
  s += d.getSeconds() + "-08:00";//alert(s);var queryStringVals = $().SPServices.SPGetQueryString();var taskID = queryStringVals["ID"];

$().SPServices.SPUpdateMultipleListItems({
listName: "Custom Aging",
CAMLQuery: "<Query><Where><Eq><FieldRef Name='bscParentTask' LookupId='TRUE'/><Value Type ='Lookup'>"+ taskID +"</Value></Eq></Where></Query>",
valuepairs: [["DateCompleted", s]]
}); 
}else {
alert("Shorter than");
}
});

The above code works.  I also discovered that the ISO date can have time as either 0:0:0 or 00:00:00, didn't seem to make a difference and both worked for me. 

Next I plan on modifying the query to only update items which belong to the the parent and don't have a Date value in their Date Completed fields.  Thanks again for all the suggestions.


Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>