1

Is it possible to cancel a save of a list item but still run the workflow. How would I go about doing this?

Example: I save an item in a list. It runs the workflow, but the save item does not appear in the list.

1 Answer 1

0

You can do this:

function presaveaction(){
    modifyColumnToRunEditedWorkflow(ItemID);
    return false;        
}

function modifyColumnToRunEditedWorkflow(id){
    var clientContext = new SP.ClientContext("site");
    var oList = clientContext.get_web().get_lists().getByTitle('List Title');
    var oListItem;
    oListItem = oList.getItemById(id);
    oListItem.set_item('ColumnToEdit', 'value');
    oListItem.update();
    clientContext.executeQueryAsync(Function.createDelegate(this, updateListItemOK), Function.createDelegate(this, updateListItemError));
}

function updateListItemOK() {
    alert('Item updated and workflow is run');
}

function updateListItemError(sender, args) {
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.