SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

That's basically the whole question. We need to be able to react -- preferably instantly -- in the event a Sharepoint workflow is canceled by a user. (Have to send some emails, update some database records, etc. Long story.)

How can we do that? I was thinking, for the lack of a better way, to create a timer job with a 1-minute interval that queries all of our list items, gets the associated workflows and checks their status. This would put a HUGE additional load on our servers, though, and an event-based solution would probably be best.

share|improve this question
Is this an out of the box WF created in SharePoint Designer or WF made in Visual Studio? – Anders Aune Mar 27 '12 at 11:59
Visual Studio. Sorry, updated my question. – Mihai Mar 27 '12 at 13:44
up vote 1 down vote accepted

You can implement your SPWorkflowEventReceiver and put your code in one of the handlers of this class (I do not remember which handler is invoked on cansel action).

share|improve this answer
There is none :-( The events I can handle are "started", "completed" and "postponed". – Mihai Mar 27 '12 at 13:58
I have another idea ) Could you add event handler to the workflow history list. If you cancel a workflow I hope a new item is added to this list and one of this item filed contains "cancel" status, other fields should contain information about workflow ) – Alexander Mar 27 '12 at 14:21
You, sir, are a genius. – Mihai Mar 27 '12 at 15:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.