7

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:

2
  • 3
    According to the first blog post, it was a bug in the salesforce system according to the R&D - did you try opening a case with the Salesforce Support?
    – subodhbahl
    Commented Sep 11, 2013 at 16:45
  • I second opening a case. Support really wants to hear about this kind of thing, where something works in an unexpected way after a major release. Commented Sep 19, 2013 at 0:05

1 Answer 1

2

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.

2
  • Thank-you for looking into this exception. It only fails to fire the attachment trigger, when attachments are added when editing or creating new Tasks in Salesforce. I've created a support case with Salesforce.
    – rcraven
    Commented Oct 4, 2013 at 17:59
  • I've created a case with Salesforce basic support to promote this issue as a platform bug however, Salesforce support has closed our support case since we are not a Partner nor do we pay for Premier support.
    – rcraven
    Commented Oct 15, 2013 at 16:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .