Deleting Task when hitting a certain stage on the deal pipeline?

Deleting Task when hitting a certain stage on the deal pipeline?

Hi,

I have tried using this script but haven't managed to get it to work (https://www.zoho.com/crm/resources/tips/auto-close-tasks-based-on-deal-stages.html)

Essentially I am looking to delete or close all task when deal hits a certain stage.  

Can anyone help?

Thanks
Jon