0

Long story short, I have an event receiver on a list item which listens for the ItemAdded event, makes some additional changes to the newly created item, calls listItem.SystemUpdate() and starts a workflow on that item.

The problem is that, even though I do these things in the same thread, the workflow sometimes sees the list item the way it was right after creation, and goes on using that stale data. My guess is that SystemUpdate doesn't really save the changes to the database, or doesn't do it in a transaction scope, or does it asynchronously. Am I right? If so, how can I force commit the changes to the database?

3

ItemAdded is an asynchronous method, that's why. you probably want to modify your data before you create the item (within ItemAdding) and commit it to the database, so your workflow runs on that item's data you've just created/modified.

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.