Skip to main content
added 8 characters in body
Source Link
Ashwani
  • 22.7k
  • 4
  • 41
  • 73

Merge following code in trigger:

   // fetch attachments for Opportunity
   AttachmentList<Attachment> attList = [SELECT id, Name, body, ContentType FROM Attachment WHERE ParentId = : opp.id];
    
   // List of attachments handler
   Messaging.EmailFileAttachmentEmailFileAttachment[] efaList = new Messaging.EmailFileAttachment();
   for(Attachment att : attList)
   {
     // Create the email attachment
     Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
     efa.setFileName(att.Name);
     efa.setBody(att.body);
     efa.setContentType(att.ContentType);
     efa.setInline(false);
     efaList.add(efa);
   }
    
    // Attach files to email instance
    email.setFileAttachments(efaList);

You can read in more detail here

Merge following code in trigger:

   // fetch attachments for Opportunity
   Attachment attList = [SELECT id, Name, body, ContentType FROM Attachment WHERE ParentId = : opp.id];
    
   // List of attachments handler
   Messaging.EmailFileAttachment efaList = new Messaging.EmailFileAttachment();
   for(Attachment att : attList)
   {
     // Create the email attachment
     Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
     efa.setFileName(att.Name);
     efa.setBody(att.body);
     efa.setContentType(att.ContentType);
     efa.setInline(false);
     efaList.add(efa);
   }
    
    // Attach files to email instance
    email.setFileAttachments(efaList);

You can read in more detail here

Merge following code in trigger:

   // fetch attachments for Opportunity
   List<Attachment> attList = [SELECT id, Name, body, ContentType FROM Attachment WHERE ParentId = : opp.id];
    
   // List of attachments handler
   Messaging.EmailFileAttachment[] efaList = new Messaging.EmailFileAttachment();
   for(Attachment att : attList)
   {
     // Create the email attachment
     Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
     efa.setFileName(att.Name);
     efa.setBody(att.body);
     efa.setContentType(att.ContentType);
     efa.setInline(false);
     efaList.add(efa);
   }
    
    // Attach files to email instance
    email.setFileAttachments(efaList);

You can read in more detail here

added 91 characters in body
Source Link
Ashwani
  • 22.7k
  • 4
  • 41
  • 73

Merge following code in trigger:

   // fetch attachments for Opportunity
   Attachment attattList = [SELECT id, Name, body, ContentType FROM Attachment WHERE ParentId = : opp.id]id];
    
   // List of attachments handler
   Messaging.EmailFileAttachment efaList = new Messaging.EmailFileAttachment();
   for(Attachment att : attList)
   {
     // Create the email attachment
     Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
     efa.setFileName('attachmentatt.pdf'Name);
     efa.setBody(att.body);
     efa.setContentType(att.ContentType);
     efa.setInline(false);
     efaList.add(efa);
   }
    
    // Attach files to email instance
    email.setFileAttachments(efaList);

You can read in more detail here

Merge following code in trigger:

   // fetch attachments for Opportunity
   Attachment att = [SELECT id, body FROM Attachment WHERE ParentId = : opp.id]
    
   // List of attachments handler
   Messaging.EmailFileAttachment efaList = new Messaging.EmailFileAttachment();
   for(Attachment att : attList)
   {
     // Create the email attachment
     Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
     efa.setFileName('attachment.pdf');
     efa.setBody(att.body);
     efaList.add(efa);
   }
    
    // Attach files to email instance
    email.setFileAttachments(efaList);

You can read in more detail here

Merge following code in trigger:

   // fetch attachments for Opportunity
   Attachment attList = [SELECT id, Name, body, ContentType FROM Attachment WHERE ParentId = : opp.id];
    
   // List of attachments handler
   Messaging.EmailFileAttachment efaList = new Messaging.EmailFileAttachment();
   for(Attachment att : attList)
   {
     // Create the email attachment
     Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
     efa.setFileName(att.Name);
     efa.setBody(att.body);
     efa.setContentType(att.ContentType);
     efa.setInline(false);
     efaList.add(efa);
   }
    
    // Attach files to email instance
    email.setFileAttachments(efaList);

You can read in more detail here

Source Link
Ashwani
  • 22.7k
  • 4
  • 41
  • 73

Merge following code in trigger:

   // fetch attachments for Opportunity
   Attachment att = [SELECT id, body FROM Attachment WHERE ParentId = : opp.id]
    
   // List of attachments handler
   Messaging.EmailFileAttachment efaList = new Messaging.EmailFileAttachment();
   for(Attachment att : attList)
   {
     // Create the email attachment
     Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
     efa.setFileName('attachment.pdf');
     efa.setBody(att.body);
     efaList.add(efa);
   }
    
    // Attach files to email instance
    email.setFileAttachments(efaList);

You can read in more detail here