Quantcast
Viewing all articles
Browse latest Browse all 6517

New Post: SPUpdateMultipleListItems dynamic query and value?

Thanks for the tips Marc and Geoff,

So I added the conversion function you mentioned Geoff, as well as removing the extra comma Marc suggested and still nothing.  Here is my complete code currently;

$(document).ready(function() {

fields = init_fields_v2();
// Get value from a date fieldvar dateCompleted = getFieldValue('DateCompleted',true);var dateComp = new Date(dateCompleted);
alert (dateComp);var strLength = dateCompleted.length;
alert(strLength); 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"];
alert(taskID);var query = "\"<Query><Where><Eq><FieldRef Name='bscParentTask' LookupId='TRUE'/><Value Type ='Lookup'>"+ taskID +"</Value></Eq></Where></Query>\"";
alert(query);var value = "[[\"Date Completed\", \"" + s + "\"]]"
alert(value);

$().SPServices.SPUpdateMultipleListItems({
listName: "Custom Aging",
CAMLQuery: query,
valuepairs: value
}); 
}else {
alert("Shorter than");
}
});

When I alert the query variable I get

"<Query><Where><Eq><FieldRef Name='bscParentTask' LookupId='TRUE'/><Value Type='Lookup'>1</Value></Eq></Where></Query>"

and when I alert the value variable I get

[["Date Completed", "2012-11-7T0:0:0-08:00"]]

My Date Completed field does not use time, so the time seems to format as 0:0:0 when converting.
I thought this might be the issue so I tried a few different ideas. I modified the code to test each of these values "2012-11-7T00:00:00-08:00", "2012-11-7T00:00:00-8:00", and even "2012-11-7" but none of them made a difference.

I will continue to look into this, but wanted to post an update on where things stand. Thanks for all the help so far.


Viewing all articles
Browse latest Browse all 6517

Trending Articles



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