Workflow running on deleted list item RRS feed

  • Question

  • Hi All,

    I've put together a workflow that has a 1 hour delay in it to check for a certain date and time on a list item.  That runs fine and I don't have any problem with that.

    When it was moved to the production server there were a few test items added to make sure it worked.  One of these items has been deleted while the workflow was still running.  I go into Workflow Settings in the List Settings and the workflow is showing 1 instance running but there are no items on the list.  Normally, I wouldn't worry about this as it doesn't seem to be doing any harm.

    However, because of the importance of the workflow - there's a try catch block that emails me in case of an error in any of the steps.  So every hour, this workflow emails me to tell me that there's no list item.

    Is there anyway I can stop this instance from running without the list item?  All the stuff on the web talks about using the list item.  Can I do it in code from the workflow association on the list or anything similar?


    Monday, January 4, 2010 11:00 AM


All replies

  • I think I had deleted item from a list while the workflow running, but didn't have this issue. Are you able to find the item in your Recycle Bin? What if you delete it from there as well.

    Monday, January 4, 2010 12:45 PM
  • I have this problem to :) If you delete it from recycle bin the workflow don't work and you don't have a way to stop it anymore ( restore item from recycle bin => stop workflow => delete item  )

    After reading that http://blogit.create.pt/blogs/miguelisidoro/archive/2009/02/07/SharePoint-2007-Workflow-_2D00_-Using-the-OnWorkflowItemDeleted-activity.aspx i may have a workaround

    Just add this code in the invoke event of the onworkflowitemdeleted activity:

    Monday, January 4, 2010 3:47 PM
  • Hi

    Again, thanks for your answer.

    I didn't use code in the project at all and don't know how to do it (I know c# but don't know where to insert the code and how to merge code with sharepoint). For now, all i did is to work with the Sharepoint designer - the wizard for creating a workflow, without a code, so i don't know where to insert that code you gave.

    תודה איתי

    Thursday, March 1, 2012 10:02 AM
  • hi,

    why don't you remove the workflow by selecting the remove option. Then it will cancel all the running instances of the workflow.



    Sunday, December 16, 2012 11:45 PM
  • Just a quick question on the following commands


    onworkflowitemdeleted activity:



    Where do you put that code?  is that something on the SharePoint Servers?

    Or is that something you have to put in each and every workflow on the farm?


    Thursday, March 24, 2016 2:44 PM