updateItem

Feb 26, 2010 at 5:10 PM

For some reason I can't seem to get this snippit of code to work... The updateItem returns that the result was a success, but it doesn't seem to update the field:

var id = querystring('ID');
var folderPath = 'test';
var siteurl  = "https://domain/mysite/url/";
var listname = "List Name";
var mylist = jP.Lists.setSPObject(siteurl, listname);
mylist.ViewFields = [{title:'hasFolder',internalName:'hasFolder'}];
var qry = "<Where><Eq><FieldRef Name='ID' /><Value Type='Number'>"+id+"</Value></Eq></Where>";
var myitems = mylist.getSPItemsWithQuery(qry,1).Items;
mylist.updateItem({ID:id,hasFolder:folderPath});

Is there something I'm doing wrong? Basically just trying to mark a folder path if it doesn't exist already, some of this is out of context.

Coordinator
Feb 26, 2010 at 6:29 PM

updateItem takes an array of objects as input.  That way you can update multiple records at a time.

Change above call to

mylist.updateItem([{ID:id,hasFolder:folderPath}]);

 

Coordinator
Feb 26, 2010 at 6:39 PM

Ken is right you are missing brackets to updateItem statement.

jPoint allows you to do mass updates to the list:

Example:

mylist.updateItem([{ID:id,hasFolder:folderPath}, {ID:id2,hasFolder:folderPath2}, {ID:id3,hasFolder:folderPath3}]);
Feb 26, 2010 at 7:04 PM

Doh, thank you!

It was driving me crazy, I couldn't figure out what I was missing... Too many enclosing characters in Javascript these days, heh.

Coordinator
Feb 26, 2010 at 7:41 PM
Would we be able to update the function so that if the parameter is not an array of JSON objects, but instead one JSON object, that we make it an array so the rest of the function works as expected?  If so, we can put this into our next update.

-Will

On Fri, Feb 26, 2010 at 2:04 PM, Ne0nx3r0 <notifications@codeplex.com> wrote:

From: Ne0nx3r0

Doh, thank you!

It was driving me crazy, I couldn't figure out what I was missing... Too many enclosing characters in Javascript these days, heh.

Read the full discussion online.

To add a post to this discussion, reply to this email (jPoint@discussions.codeplex.com)

To start a new discussion for this project, email jPoint@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com




--
William Lawrence
703-873-7035