+ Start a Discussion
Sunny_SlpSunny_Slp 

How to send PDF versions of records to external server

Hi everyone, I have a requirement where, whenever a new record (of a custom object) is created a PDF version of this record should be sent to an external server.

 

I thought of creating a visualforce page that generates the required PDF document and then write apex code to attach the PDF to another object ( created for this very purpose). Then use outbound message to send the object along with the attachment ( which now has the PDF document) to an external server but I realized outbound messaging cannot be used to send attachments of an object.

 

If generating and sending a PDF document cannot be based on a save event, is it possible  to send the PDF documents of records(created on that day) to an external service? (so, instead of sending everytime a new record is created; send it once a day)

 

Any help will be greatly appreciated.

 

Thank you,

 

Sunny Slp

Ritesh AswaneyRitesh Aswaney

sure you can write scheduled batch apex which looks for records created since the time of the last send, creates pdf documents, attaches it to an outbound email and emails it.

 

whilst outbound messaging cannot be using for sending attachments, sending email via apex is quite straightforward.

 

http://blog.jeffdouglas.com/2010/07/16/create-and-email-a-pdf-with-salesforce-com/

 

 

Sunny_SlpSunny_Slp

Ritesh,

 

Thanks a lot for the reply. I really appreciate you taking time out to help me.

 

I have gone through that post before, here is what I don't understand.  If I end up using SingleEmailMessage to send documents over to an external service I would be limited by the no.of emails that I can send in a day, and also by the 10MB attachment limit( so, I cannot, say have all the records created today attached to a single email and send it nor can I have thousands of mails with single attachment sent ).

 

I'm not sure if this is even a possibility, but can a HttpRequest be used for sending documents ?

 

Thank you,

 

Sunny Slp