Creating a custom event handler to auto-publish on an item save

Event handlers play a big role in Sitecore to intercept events being executed. When any event is raised, it executes multiple event handlers sequentially, which is the same that a pipeline does with its processors. We can create our own event handler to apply custom logic to events such as an item getting created, saved, published, or deleted, and many others.

Consider a case where our application pulls a new press release from external resources. It creates and saves a news item in Sitecore, which should get published immediately without delay. Otherwise, consider a case where we have to export the details to an external data source immediately. In this recipe, you will learn how ...

Get Sitecore Cookbook for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.