AnsweredAssumed Answered

How do I add attachments to composePackage?

Question asked by Francesca Shiekh on Aug 29, 2016
Latest reply on Sep 20, 2016 by Tevfik Tümer

I have a custom compose for Email drawer that works well but I want to add attachments to it.

I get the attachments and defined the attachments array as follows:

        $attachments[$a['id']] = array(
          'id' => $a['id'],
          'filename' => $a['filename'],


And I'm passing it as follows:

    //build the return the package
    $composePackage = array(
      'to_addresses'     => $toAddresses,
      'cc_addresses'     => $ccAddresses,
      'parent_type'      => 'Cases',
      'parent_id'        => $case->id,
      'parent_name'      => $case->name,
      'subject'          => $subject,
      'html_body'        => $preBodyHTML . $body,
      'body'             => $preBodyHTML . $body,
      'attachments'      => !empty($attachments)?$attachments:array(),

but the attachment is not appearing in the compose window.

Where am I going wrong?