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
Mahmood ButtMahmood Butt 

BeforeDelete trigger not firing on ContentDocumentLink object.

I have a trigger on ContentDocumentLink object. I have use case to show total number of Files and number of notes attached if the link was between Events and Content (Files/Notes) using Salesforce Content. And, offcourse, similar thing that needs to be done when a content is removed, I implemented beforeDelete event as well.

Code
trigger ContentDocumentLinkTrg on ContentDocumentLink (after insert, before delete)  
{
    //Check if customization is not enable through custom settings
    if(!CustomSettingsUtil.IsCustomizationEnabled())
    {
        return;
    }
    String BeforeOrAfter = (Trigger.isBefore ? 'Before' : 'After');
    String TriggerType = ''
        + (Trigger.isDelete ? 'Delete' : '')
        + (Trigger.isInsert ? 'Insert' : '');
    system.debug(BeforeOrAfter + ' ' + TriggerType );
    // run TriggerHandler
    new ContentDocumentLinkTriggerHandler().run();
}
Checking the debug log, it is entering the AfterInsert event but not BeforeDelete. I see no restrictions in the SF documentation, can anyone put some light on this, please.
Apex developer 21Apex developer 21
Dit you managed to get this working?