Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

    Advertisements
  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand
  • Advertisements

Finding an Orphaned Workflow & Cancelling it

Posted by Paul on August 29, 2012


Last week I encountered a weird problem like below:

  • A task email was being sent to the user
  • The document associated with the task is already deleted
  • SharePoint keeps sending task overdue emails
  • How to cancel the workflow?

The task email looks like “Task created on 04/01/2012 is overdue”

How to resolve this problem?

I would recommend the following solutions:

  • Use the workflow.aspx to locate and terminate the workflow

If not possible due to page corrupted or task is deleted:

  • Use wfterminator.codeplex.com to terminate the workflow

If not possible due to SharePoint 2007:

  • Install the latest cumulative update pack which should have fixed the problem.

If not possible due to deployment hassles or problem being repeated:

  • Use Server Object Model to create a program to find list by ID and delete workflow associated

If not possible due to invalid list id / list not retrievable for deleted status

  • Contact Microsoft Support if you have a paid support privilege

If not possible as you do not have paid support

  • Find the workflow instance from content database & change the columns InternalState & Status1 to 8

About manually updating the Database

Now you are reading something which Microsoft does not recommend.  I repeat usage of Server Object Model is  the best way.  But as you failed all the above steps and your customer is yelling then you have to proceed this difficult path.  Use this option when there are no customers online, recommend a restart of IIS application for WFE after this.

Step 1: Locate the ListId from AllDocs table

The AllDocs table contains a column LeafName which should be matching your document name for eg: info.doc.  Take the corresponding ListID value from there, which is actually a GUID.

eg: SELECT * FROM AllDocs WHERE LeafName=’info.doc’

Step 2: Go to the Workflow table to find instances

Use the ListId to fetch Workflow instance matching it: SELECT * FROM Workflow WHERE ListId=’GUID’

Step 3: Find the culprit record

Locate the right record using InternalState and Status1 column which should be equal to 2 stating Running.

You should be able to filter further using the Created column representing the task creation date. (it should be matching the customer email)

For your reference please find the SPWorkflowState enumeration.

image

Step 4: Fix the record

Change the InternalState & Status1 columns to 8 (For Canceledl).

Make sure you are changing only 1 record for 1 email problem.

Step 5: Restart WFE

Restart the WFE (not required exactly as workflow is executed by timer job) and inform the customer.  He/she should not receive the email  once after that.

Good Luck – and do not say my name Smile

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s