No announcement yet.

Email PDF attachment created in Prior Destination as channel Attachment.

  • Filter
  • Time
  • Show
Clear All
new posts

  • Email PDF attachment created in Prior Destination as channel Attachment.

    I have a destination chain that writes out a PDF report using HTML formatting with a document writer connection.

    I retrieve the attachment id with the following line of code contained in the transformer of the next destination in the chain.
    channelMap.put('attachmentID', getAttachments().get(0).getAttachmentId())
    That line of code gets a value of along the lines of -> ${ATTACH:1a2b3c4d-1a2b-1a2b-1a2b3c4d5e}. At this point i can use the attachment viewer from the channel dashboard and see the pdf generated. ( its turned sideways but it is formatted correctly).

    The next destination is an SMTP sender with a plain text message body stating see attached report.

    I have set up the attachment section as below.
    Name Content MIME type
    My Reprot.pdf ${attachmentID} application/pdf

    I get my email. My pdf is always corrupt even though it is around the proper size in kb.

    I have searched the forum boards and have found topics dealing with base64 encoding, addAttachment(), reading from a directory etc. I haven't found the key words of my issue yet.

    I feel like I am 99% of the way there.

  • #2
    It was a really stupid thing. Instead of ${attachmentID} in the content field of the attachment table, all I needed to do was put attachmentID. Similar to the metadata tables on the channel definition page the table is already in a code context Thus there isn't a need to use ${} to escape.

    Posting this answer to help the next poor sap not be like me. ::facepalm