|

How to track deleting items on Sitecore

Background :

In general, the content management team is responsible for the content edition on Sitecore instances. Sometimes, some pages are deleted by mistake. Often content team think that the page has disappeared from the server by itself and that the problem is in Sitecore (or a mistake from developers).

To check the point, we need a deletion history.

In Sitecore, we have one way to do it is through the recycle bin. Still, I find the search not very practical, and you can’t go far back in history

What is the alternative ?

I thought of a classic solution that works! The solution consists to catch each page deleting and store item information in a custom database.

What i need ?

  • Custom database to store data
  • Add connection string for DB newly created to the global connection string file
  • Add a new pipeline to catch deleting and send data to SQL server
  • Add Configuration patch to call the pipeline

Custom Sitecore Database creation :

  • Go to your SQL Server instance
  • Create a new custom database
  • Create a new table (DeleteStats for example) with three columns (ID, UserName, Date) – You can add fields if you need to store more informations
When creating Database, think to follow the naming convention and the name of existing databases.

Add custom database connection string

Update Deleting Statistics Pipeline :

Configuration Patch :

Check entries in the custom database :

Attention, playing with databases could represent a risk for your application. With Sitecore, we are not supposed to manipulate the databases. So, it is recommanded to entrust this kind of action to a Sitecore administrator or architect. 

Enjoy 🙂

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *