views:

599

answers:

3

I have a workflow running on an item in a list. The workflow has an OnWorkflowItemChanged activity sitting within a While activity. I know that the workflow enters the While loop, and if I update the item through the UI, it fires the OnWorkflowItemChanged activity. However, if I update the item programmatically (through a console application), it not only does NOT fire the OnWorkflowItemChanged activity, but it stops responding to updates through the UI as well.

Has anyone seen this before? Is there a way to update the list item programmatically and have the workflow both respond to the event and continue responding to future events?

edit: It works fine if I use the Lists web service to update the item. Why does it mess up if I use the object model?

A: 

I know when updating a list item through the object model in an event receiver you can call SPEventReceiverBase.DisableEventFiring(), etc. SPEventReceiverBase.DisableEventFiring() Have you tried that, or is there a workflow equivalent?

Here's a hack to disable event firing on updates that aren't triggered from inside an event receiver: link text

Chloraphil
DisableEventFiring() and EnableEventFiring() are for Event Receivers to prevent recursive calls. They are not available for workflows or for external code. Also, I don't see why calling the SPListItem.Update() method would disable the event firint to begin with - it shouldn't.
added the link i meant to include above
Chloraphil
I tried setting it to EnableEventFiring both before and after the Update, but it still does not fire the event or respond through the UI. item["Decision 1"] = "Concur"; SPEventManagerWrapper.EnableEventFiring(); item.Update(); SPEventManagerWrapper.EnableEventFiring();
you have two enables there instead of one disable and one enable
Chloraphil
I know. The problem is not that events are firing and I want them not to. The problem is that events are _not_ firing and I need them to.
ah. Misread that.
Chloraphil
A: 

Yup i agree the problem is that event is not at all firing. I have noticed that if you reset IIS it works for the first time but after that there is no update.

A: 

It looks like the only way to make the events fire is to use the Lists Web Service.