AnsweredAssumed Answered

How to End a workflow from code?

Question asked by tanna_nishit on Mar 11, 2015
Latest reply on Mar 18, 2015 by fhunth

I am looking for a solution to end a workflow from code. I have a state machine workflow in nintex. When the workflow is in progress, we need to change the state of this workflow in certain 'special' situations. Currently, we are using below code to cancel existing workflow and then we start a new workflow. The new workflow checks the status of the list item and then switches the state accordingly.



//Cancel existing workflows if any

SPWorkflowCollection existingWorkflows = manager.GetItemActiveWorkflows(item);

foreach (SPWorkflow existingWorkflow in existingWorkflows)






Is there a way to 'Complete' the workflow and not cancel it?