public class AttachmentTriggerHandler {

    public static void onAfterInsert(List<Attachment> attachments) {

        handleCreditReportAttachments( attachments );  


    public static void onAfterUpdate(List<Attachment> attachments, Map<Id, Attachment> attachmentOldMap) {

        handleCreditReportAttachments( attachments );    


    private static void handleCreditReportAttachments( List<Attachment> attachments) {

        // Get the Credit Report object record prefix  
        String getPrefixOfCreditReport = creditchecker__Credit_Report__c.sobjecttype.getDescribe().getKeyPrefix();
        Set<Id> setAttachmentIds = new Set<Id>(); 
        for( Attachment attachment: attachments ){
            String attachmentParentId = attachment.ParentId;
            String attachmentParentIdPrefix = attachmentParentId.left(3);

            // Add attachment record Id in the set
            if(attachmentParentIdPrefix == getPrefixOfCreditReport) {

        // Call the Queueable method so that it makes a callout to Box.com and create the attachment
        if( !setAttachmentIds.isEmpty() ) {

            AsyncBoxAttachment asyncJob = new AsyncBoxAttachment( setAttachmentIds );

            Id jobID = System.enqueueJob(asyncJob);

            System.debug( 'jobID : ' + jobID );



I'm getting two errors 1.Invalid type: AsyncBoxAttachment,2.Method does not exist or incorrect signature: void enqueueJob(AsyncBoxAttachment) from the type System. Please guys help me it is my first trigger.

  • 3
    The error suggests that you don’t have a class named AsyncBoxAttachment implementing a Queueable, do you have that?
    – Jayant Das
    May 25, 2019 at 14:59

1 Answer 1


Seeing the AsyncBoxAttachment and the exact error would help. However, here's what I'd check:

  • That you defined the AsyncBoxAttachment class and that it's accessible to the AttachmentTriggerHandler.
  • Is it possible that AttachmentTriggerHandler is an Inner class? If so, you need to call it as OuterClass.AttachmentTriggerHandler = new OuterClass.AttachmentTriggerHandler(setAttachmentIds)

I think once you fix the Invalid Type Exception, the second error will resolve itself

  • This one ended up in a review queue today. I think I'll flag this one for the mods to convert to a comment rather than voting to delete (of course, you could do that yourself).
    – Derek F
    Jan 21, 2020 at 20:56

You must log in to answer this question.

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