function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
lzanotti1987lzanotti1987 

How i can prevent the delete of note&attachment from the Parent object delete?

Hi at all,

i have this little problem on my org: i have a parent custom oject "Order__c" that have the related Notes and Attachments.

I create one trigger that fire before the delete of the attachment and prevent the delete for certain Profile.

But if the same profile can delete the parent record (and he is able to do it through the Object level security by this profile) the trigger doesn't fire!

How can i fire again the same trigger? should i fire it by the delete of Parent record?

Thanks in advance
Regards
Luca

Best Answer chosen by Admin (Salesforce Developers) 
SFFSFF

Yes, actually. It sounds like your requirement is "prevent delete of attachments for object Object__c by members of profile X, and if an attachment exists, also prevent delete of Object__c by members of profile X". In that case, you need a before-delete trigger on Object__c.

 

Hope this helps,

All Answers

SFFSFF

Yes, actually. It sounds like your requirement is "prevent delete of attachments for object Object__c by members of profile X, and if an attachment exists, also prevent delete of Object__c by members of profile X". In that case, you need a before-delete trigger on Object__c.

 

Hope this helps,

This was selected as the best answer
lzanotti1987lzanotti1987

Thanks a lot John.

Best Regards
Luca