I have a requirement where Cases closed over x amount of days should be removed from Salesforce. However, when deleting the Case, the subsequent e-mail messages and attachments linked to both e-mail messages or the Case record itself are also deleted, and this is what I wanted to prevent.
So far what I have tried was creating a before delete trigger on the Attachment object, adding it an error to the sObject. This works for "manual" deletions but gets bypassed when a Case is deleted (meaning the attachments are still being cascade deleted).
Does anyone have an idea of how can this be achieved?
Best regards and thank you in advance!