0

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?

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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