[SalesForce] Attachment trigger not firing, is this a bug

The Attachment Trigger is not firing for before insert and after insert events when attachments are added via the UI (Related to Tasks) in Winter 14 Sandbox, is this a bug? I've reviewed the known issues site and couldn't find anything similar. However, I did find others having issues with this same Trigger in the past (some reporting that the issue was resolved?). Can anyone shed some light on this?

Here is a quick example for before insert:

Apex Trigger:

trigger Attachment_Trigger on Attachment (before insert) {
    if(Trigger.isBefore)
    {
        if(Trigger.isInsert)
        {
            Attachment_BI_Add_Test.testChanges(Trigger.new);
        }
    }
}  

Apex Class:

public class Attachment_BI_Add_Test {

    public static void testChanges(Attachment[] newAttachments)
    {                
        for(Attachment a : newAttachments)
        { 
            a.name = 'test';
            a.Description = 'test';
        }
    } 
}

Other resources found with similar issues:

I've also checked the docs for operations that don't invoke triggers however, attachments are not mentioned:

Best Answer

Here is my POC to show that winter '14 don't have such issue like On inserting an Attachment from UI doesn't fire the trigger.

I create the trigger and Apex class from the sample you provided and then inserted an Test Attachment file from UI on a record.

Trigger:

Attachment Trigger

Class:

Class same as sample but added debugs

Debug: Debug logs created for attachment trigger and System.debug lines were there. Debug log

Attachment has been renamed as "test" Note Attach

However on attachment upload notification detail page it doesn't show the name changed (even trigger got fired). It shows changed name (as sample trigger did) in related list.

There were no issues in trigger, may be this issue has been solved. Hope this help.

Related Topic