Search code examples
javapdfencodingsugarcrmuploading

Can I upload a PDF to SugarCRM via a Document object?


I am attempting to figure out how to upload a dynamically generated PDF file to SugarCRM using Java.

At first I thought I would simply need to create a Document object and fill in some field expecting a byte[] 64Bit encoded as a String. However, from what I've read online, what I'm looking for is not a Document but a Note with an attachment. That seems like a poor naming convention in use; am I correct in assuming I need to be creating Notes?

In this question I am simply asking for clarification on what a Document is, and if it is suited for containing a PDF document or if the only method for uploading a file like a PDF is through Notes and their attachments.

(I will ask a followup question elsewhere depending on this question's answer.)

Thank you.


Solution

  • You should be able to use both Document and Note, but in SugarCRM they are used for two different things.

    • Documents: Used for common documents that you want to share with the users and customers (e.g. Letter templates, Product briefs, Terms, etc)
    • Notes: Used for documents (or files actually) related to a specific Account, Contact, or similar, which most commonly is for the users only (e.g. Business cases, Emails, Contracts, etc)

    You can upload both documents and notes to SugarCRM through the Soap API.

    • Documents: Use set_document_revision
    • Notes: First use set_entry with a Note, and afterwards set_note_attachment to upload and relate the file

    (Disclaimer: I haven't used the "upload documents" in sugarCRM before, but according to the wsdl, it should be possible)