Question

I attach three events to my CustomLists:

  • ItemAdded
  • ItemUpdated
  • ItemDeleting

On one list I have a workflow, which is changing columns in that list. So when I edit an entry in that list, the ItemUpdated-Event fires two times. On the other lists (without any workflows) my receiver is working fine.

How can I find out if a workflow called my event receiver?

Is there a difference between a workflow which fires the event, or a user who fires the event?

Was it helpful?

Solution

You can add hidden field to the list which is always sets by workflow (and only by workflow). Then you will see if workflow called the event receiver.

Or

You can create HandleEventFiring class in your workflow project and use DisableAllEventFiring and EnableAllEventFiring before and after updates in workflow

public class HandleEventFiring : SPItemEventReceiver
{

  public void DisableAllEventFiring()
  {
   this.DisableEventFiring();
  }

 public void EnableAllEventFiring()
 {
  this.EnableEventFiring();
 }

}

OTHER TIPS

To answer your first question:
Yes, you can find your workflow. The easiest way would be to use the SharePointManager 2010 and

  1. Navigate to your site collection is located
  2. Lists -> [Your List] -> Event Receivers
  3. Check each Event Receiver's properties and delete the event receiver that is firing twice.

I don't know if I understand your second question correctly, but here goes:
A workflow can be started manually by a user or automatically if a List Item is

  • Added
  • Updated or
  • Deleted

Other than that there is not much of a differance.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top