Tuesday, November 8, 2011

Difference between SharePoint workflows and SharePoint event handlers


The main differences between SharePoint event handlers and SharePoint workflows are:
Initiation
SharePoint event handlers are automatically initiated, while SharePoint workflows can be initiated either automatically or manually.
Response
A SharePoint event handler always responds to an event that has taken or is taking place on an item, while a SharePoint workflow does not necessarily have to react to an event that is taking place. While it can react to an item being created or changed, you can also manually start a workflow after an item has been created.
User Interaction
SharePoint event handlers have no user interface, so users cannot interact with event handlers. On the other hand, you can create either ASP.NET or InfoPath forms to provide user interactivity with SharePoint workflows. And you can add even more interactivity by using SharePoint Tasks lists along with the workflow.
Duration
SharePoint event handlers run for a short period of time (generally seconds), while SharePoint workflows may run for a much longer time period (days, months, or even years).
Robustness
Since SharePoint workflows are hydrated and dehydrated, they can “survive” server reboots, while SharePoint event handlers cannot.

When to choose what?

When deciding whether to go with a SharePoint event handler or a SharePoint workflow for a piece of functionality or business logic that you require, consider the 5 points mentioned above.
Go with a SharePoint event handler if the tasks you want to perform are directly related to the user taking a particular action on an item (such as adding, editing, or deleting it), you do not require the user to interact with your code, and whatever the event handler has to do is of a short duration.
Go with a SharePoint workflow if the tasks you want to perform are not directly related to the user taking a particular action on an item, you require interaction between the user and your code, your code may run for a long duration, and should live through server reboots.

No comments:

Post a Comment

Thank you for Commenting Will reply soon ......

Featured Posts

The Code 39 error occurs when Windows is unable to load the device driver for a specific hardware device. This typically indicates that the driver is corrupted, missing, or incompatible

The Code 39 error occurs when Windows is unable to load the device driver for a specific hardware device. This typically indicates that the...