Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have been using a State Machine workflow (SharePoint 2010).

Workflow design

  1. Main State:

    • The Main State does not update the item.
    • The Main State contains a OnWorkflowItemChanged.
    • When the item is changed, it will setState back to the retrieveIncident again.
  2. RetrieveIncident State:

    • The RetrieveIncident State will consume external service and update the item.

When we edit the item through SharePoint site, there is no problem, everything works fine. However, when the TimerJob edit the Item, it will sometimes loop through these two states (from 1 to 4 times).

I have tried using different update method (item.Update(), item.SystemUpdate() or item.SystemUpdate(false)), but it contains the same problem.

I have found out that when System Account updates the item, it will not trigger the onWorkflowItemChanged. So I guess that problem may come from the TimerJob that edit it?

what could be a workaround for this problem?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

If someone sees this post, the solution was to create a simple class that implements SPItemEventReceiver, and to add two methods: One to enable the event Firing and a second one to disable it.

share|improve this answer

Your Answer

 
discard

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.