Canceling or Terminating a workflow
-
I've built a custom workflow for SharePoint 2010 and would like to end the workflow at certain points based on values entered into the list item. I had originally used a codeActivity object that contained the following code:
SPWorkflowManager.CancelWorkflow(workflowProperties.Workflow)
However, with just that line of code, the workflow will still run until it gets to the end. So, I ended up adding this line of code:
Throw New Exception("Ending Workflow")
This stops the workflow, but I'm not cool with using an exception to end a workflow when no actual exception was thrown. I've looked up on the web about ending workflows and there were a few posts that had you set the tasks in the workflow as completed. However, in this workflow I don't actually assign tasks, so there isn't any tasks to complete. Does anyone have any suggestions I could try?