Here we will discuss about workflows and event receivers in SharePoint 2013. Both worflow and event receivers are very important in SharePoint and it is important to know which one to use when. It is good to know difference between event receiver and workflow in sharepoint 2013.
– Event receivers in SharePoint can be executed before or after an operation, like before adding an item or after adding an item. On the other hand workflows can be executed only after the operation like after an item added to the list or after an item update.
– The event receviers in SharePoint 2013 or event receivers in SharePoint 2016 can not be lauched manually. They always attached to a SharePoint object which will run automatically when the event occurs. But workflows can be started automatically as well as can be started manually also.
– By using an even receiver you can there is a chance that you can cancel the operation but in workflows you can not cancel the operation because already the item has been created.
– A SharePoint workflow can be started like manually, when item is added, an item updated etc but an event receiver can be in action in various events which includes delete item also.
– You can develop a workflow using SharePoint designer, visual studio, visio or by using any other 3rd party tool also. But you can develop event receiver by using visual studio only.
– You will not have any UI interaction in case of event receiver, but you can use various forms like initation form association forms in workflow for user interaction. Also SharePoint workflow provides a Workflow History to log information by default, but there is no such feature in case of event receivers.
– Event recivers will not survive after server reboots, where are SharePoint designer workflows does survive.
– Event receivers are running in a particular Web front end server, so if something goes wrong in the WFE, it may end but workflows will not.
– Event receivers can be run for very short period of time where as SharePoint workflows can run even for days, week, months or even for years.
If you got this kind of requirement, then first check if the requirement is to cancel the process then you should use event receiver. On the other hand if your business requirement wants user inputs then you should choose for workflow.