Below code is updating AssignedTo field in Task List for multiple items in List
//for updating multiple items in tasks list
var update_string="<Batch OnError='Continue'>";
var count=0;
for(var i=0;i<ArrayTest.length;i++) // ArrayTest is having list items IDs
{
count++;
update_string = update_string+"<Method ID='"+count+"' Cmd='Update'>" +
"<Field Name='ID'>"+ArrayTest[i]+"</Field>" +
"<Field Name='AssignedTo'>TestUser</Field>" +
"</Method>";
}
update_string = update_string+"</Batch>";
$().SPServices({
operation: "UpdateListItems",
async: true,
batchCmd: "Update",
listName: "Tasks",
updates: update_string,
completefunc: function(xData, Status)
{
//alert(xData.responseText);
}
});
//for updating multiple items in tasks list
var update_string="<Batch OnError='Continue'>";
var count=0;
for(var i=0;i<ArrayTest.length;i++) // ArrayTest is having list items IDs
{
count++;
update_string = update_string+"<Method ID='"+count+"' Cmd='Update'>" +
"<Field Name='ID'>"+ArrayTest[i]+"</Field>" +
"<Field Name='AssignedTo'>TestUser</Field>" +
"</Method>";
}
update_string = update_string+"</Batch>";
$().SPServices({
operation: "UpdateListItems",
async: true,
batchCmd: "Update",
listName: "Tasks",
updates: update_string,
completefunc: function(xData, Status)
{
//alert(xData.responseText);
}
});
No comments:
Post a Comment