Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. SharePoint
  4. Canceling or Terminating a workflow

Canceling or Terminating a workflow

Scheduled Pinned Locked Moved SharePoint
sharepointquestionworkspace
1 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Aptiva Dave
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups