With the ability to automate the creation of Tasks in Salesforce using Workflow Rules, Salesforce can be a powerful tool for driving success with your team. When an Opportunity reaches a critical Stage, a task can be created to call the client for specific, timely information. When a Case closes, a task can pop up to remind your team to follow up in a month and see how things are going. Tasks can be deleted by anyone, which allows users to remove unnecessary to-do items, but it can cause all sorts of problems. A deleted open Task can’t remind your users to complete a critical step, and a deleted closed Task can’t be reported on. You need a way to prevent the deletion of tasks to avoid these and other issues.
You can prevent the deletion of Tasks using a Trigger, which is the most intuitive solution. This is great because it is quick to write and offers the most comprehensive protection of your data – only users with specified profiles or other characteristics will be able to delete Tasks. But you’ll have to go through the process of writing test code, deploying to production, and maintaining. The easier solution is creating a Visualforce page to override the standard Delete page for Tasks. Deepak Anand wrote out a fantastic Visualforce Page in the Salesforce Success Community which can be used to do just that. It’s powerful, easy to write, and easy to add additional criteria, customize error messages, and more. Check it out!
-Jared and the Salesforce Guys