Generate a PDF from PDF Manager to the Documents Module.

I have had a couple of clients ask about this so I thought I would check to see if anyone else has come across this.

When generating a Quote PDF, the client wants to save the generated PDF as a Document record related to the Quote record. They want to be able to have a history of Quotes sent to their client and do not want to be required to download the PDF to their local machine and then upload it back to Sugar.

My high-level thoughts on this would be to add another PDF menu item, "Save PDF",  like "Download PDF" and "Email PDF". Then create a custom endpoint that would generate the PDF and save it as a document record, related to the record from which the "Save PDF" template was selected.

Looking to see if anyone has done this or has any other suggestions on how to implement it.

Parents
  • We thought of doing that, then decided against it. Since the quote has to be sent to the customer, we decided that someone has to open it and review it prior to attaching it to an email to send it so they may as well upload it once reviewed.

    If I were to do what you are proposing, I would create the menu item Save PDF as a copy of Download PDF and customize the controller.

    I've overridden the PDF generator ( How to create beautiful PDFs with CSS within Sugar « Sugar Developer Blog – SugarCRM  ) but not added to it before so I'm not quite sure of the correct approach. I included the link here so you can see how I modified the pdfaction to get my custom documents to appear in the menu.

    I think you will need to create your own pdfAction (see clients/base/fields/pdfaction) and the controller that goes with it.

    You can see in the original how they handle the download and email, that may give you a starting point for what you want to do.

    You could build your savePDF somewhat generic,  check if there is a relationship between the current module and Documents and if so create the document and link it to the current model. 

    That way if they ask you to add one for some other module (say, Contracts) you already have the structure ready.

    I will be interested in seeing what you come up with.

    FrancescaS

  • John Boyes

    I have done similar functionality,

    1. Custom PDF is generating through custom code.

    2. Email sending to contact with above PDF as attachment.

    3. Above PDF is saving as Document record in subpanel of parent record.

    For the purpose I implemented the custom pdf generation, Process Email Template, Sugar core email functions and extended PMSEEmailHandler().

    Regards

Reply Children