This project has moved. For the latest updates, please go here.

help with updating list item

Jan 9, 2015 at 8:21 PM
Hi - can someone help provide the syntax to updating an existing list item based on set of criteria?

E.g. List has two columns
Ticket# | Status
12345 | Open
42515 | Closed

I need to update only ticket # 12345. It looks like I need to know the ID in order to update a specific item, how do I grab the ID for where ticket# = 12345?

Any help is greatly appreciated.

Jan 9, 2015 at 8:47 PM
Take a look at the function $().SPServices.SPUpdateMultipleListItems. While you don't actually want to update multiple list items, since you don't know the ID, by specifying the ticket #, you can update the item without knowing the ID (assuming there is only one item per ticket #).

Jan 9, 2015 at 9:03 PM
pardon the ignorance, will need a little spoon feeding for this on where to put the variables in?

is this what it should be? where exactly do I put the value (12345) that I want it to update in the CAMLquery?

function UpdateItem(ticket#,new_value)
listName: "my_listname",
CAMLQuery: "<Query><Where><Eq><FieldRef Name='Ticket#'/><Value Type='Text'>Active</Value></Eq></Where></Query>",
valuepairs: [["Ticket#", new_value]]

Jan 14, 2015 at 2:56 AM
You'll need the InternalNames for the columns. It won't be "Ticket#"; it'll be encoded or different.