You need to sign in to do that
Don't have an account?
Lam Corporation
Prevent Chatter File being deleted from the "Files" related list on Account
Hi all,
I am trying to prevent the deletion with a trigger for Chatter Files from the "Files" related list on Account.
It seems to work on the Files tab but not the related list on the Account.
I have tried using the ContentVersion object, also the ContentDocument. Nothing is working.
Can anyone help? Many thanks
trigger FilePreventDelete on ContentDocument (after delete) {
for (ContentDocument record : trigger.old)
{
if (record.Id != '')
{
record.addError('You can not delete a File once uploaded');
}
}
}
I am trying to prevent the deletion with a trigger for Chatter Files from the "Files" related list on Account.
It seems to work on the Files tab but not the related list on the Account.
I have tried using the ContentVersion object, also the ContentDocument. Nothing is working.
Can anyone help? Many thanks
trigger FilePreventDelete on ContentDocument (after delete) {
for (ContentDocument record : trigger.old)
{
if (record.Id != '')
{
record.addError('You can not delete a File once uploaded');
}
}
}
Please check the below link for reference.
https://success.salesforce.com/ideaView?id=08730000000Br7fAAC
Happy to help.
Best Regards
Rahul Kumar
Does any have any other experience or ideas? thanks