Bulk update and delete using SPservice in SharePoint


$().SPServices.SPUpdateMultipleListItems({
  listName: "States",
  CAMLQuery: "<Query><Where><Eq><FieldRef Name='Status'/><Value Type='Text'>Active</Value></Eq></Where></Query>",
  valuepairs: [["Status", "Inactive"]]
}); 
This call to SPUpdateMultipleListItems will update all of the items in the States list which have their Status = "Active", setting their Status = "Inactive".
$().SPServices.SPUpdateMultipleListItems({
  listName: "States",
  CAMLQuery: "<Query><Where><Eq><FieldRef Name='Status'/><Value Type='Text'>Inactive</Value></Eq></Where></Query>",
  batchCmd: "Delete"
}); 
This call to SPUpdateMultipleListItems will delete all of the items in the States list which have their Status = "Inactive".


Comments

Popular posts from this blog

Javascript function to populate from query string