Hi,
I wrote javascript for getting list items but here I'm hard coded list name as "Projects"(my list name). How can I get list name automatically with out hard coding,
Appreciate if anyone help.
Thank you.
function DoLogicalDelete()
{
var clientContext = null;
var oList = null;
var oListItem = null;
// var lstItmIsDeleted = null;
var itmID = getQuerystring('ID');
clientContext = SP.ClientContext.get_current();
oList = clientContext.get_web().get_lists().getByTitle('Projects');
// var oListItemID = SP.ListOperation.Selection.getSelectedItems(clientContext);
oListItem = oList.getItemById(itmID); // getting ID
clientContext.load(oListItem,"Title", "IsDeleted"); // load items to oListItem
oListItem.set_item('IsDeleted', true);
oListItem.update();
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded),Function.createDelegate(this, this.onQueryFailed));
}
No comments:
Post a Comment