Today I have noticed a post in Sitecore SDN forum regarding how to disable Schedule Email Reminder task for multiple items in Sitecore. I thought it'd be better to turn it into a Blog post with more detail. It might come useful to someone. :)
Occasionally an author may wish to be reminded of something regarding the item he is working on. Sitecore Reminders are made just for that. They also make the Administrator's work easier, by providing a suitable way of notifying Editors and other staff members about changes needed to be made. Reminder settings for an item are set in the Tasks section:
You can also set reminder settings for an item by clicking on Set Reminder in Review Strip of Sitecore Content Editor Ribbon.
Occasionally an author may wish to be reminded of something regarding the item he is working on. Sitecore Reminders are made just for that. They also make the Administrator's work easier, by providing a suitable way of notifying Editors and other staff members about changes needed to be made. Reminder settings for an item are set in the Tasks section:
You can also set reminder settings for an item by clicking on Set Reminder in Review Strip of Sitecore Content Editor Ribbon.
Disabling Schedule Email Reminder task
Schedule Email Reminder task for Sitecore item can be disabled by following ways:- Using Sitecore Content Editor: You can disable reminder settings for an item by clicking on Clear Reminder in Review Strip of Sitecore Content Editor Ribbon. You can also disable reminder settings for an Item by clicking on Clear link in the Tasks section. This approach will work only for one item at a time.
- Updating tasks table of Core Database: You can disable EmailReminderTask for multiple items by modifying tasks table of Core database using below SQL query:
Update [Tasks] set Disabled=1 where taskType='Sitecore.Tasks.EmailReminderTask,Sitecore.Kernel'
Take a backup of Core db before executing this query. - Disabling TaskDatabaseAgent in web.config: In web.config, you will find below entry related to TaskDatabaseAgent
<!-- Agent to process tasks from the task database (TaskDatabase) --> <agent type="Sitecore.Tasks.TaskDatabaseAgent" method="Run" interval="00:10:00" />
TaskDatabaseAgent gets all pending tasks ( for example: EmailReminderTask, ArchiveItem, ArchiveVersion) from the tasks table of Core db and executes them one by one. So basically TaskDatabaseAgent runs scheduled tasks from the Core database. So in order to suspend EmailReminderTask you have to disable TaskDatabaseAgent by setting its value to 00:00:00 ( 00:00:00 means that Agent/Job is disabled). - Using Custom Code: Below function ClearReminder(Item item) takes Sitecore item as input parameter and clear reminder for specific item. Call this function iteratively for multiple items.
Item item = Sitecore.Data.Database.GetDatabase("master").GetItem(new ID("{D833E825-4948-4264-9D77-68CE50C72F94}")); ClearReminder(item); public void ClearReminder(Item item) { if (item[FieldIDs.ReminderText].Length > 0 || item[FieldIDs.ReminderRecipients].Length > 0 || item[FieldIDs.ReminderDate].Length > 0) { using (new Sitecore.SecurityModel.SecurityDisabler()) { item.Editing.BeginEdit(); item[FieldIDs.ReminderText] = string.Empty; item[FieldIDs.ReminderRecipients] = string.Empty; item[FieldIDs.ReminderDate] = string.Empty; item.Editing.EndEdit(); string[] strArrays = new string[] { AuditFormatter.FormatItem(item) }; Log.Audit(this, "Clear reminder: {0}", strArrays); } } }