3

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.

BlackVegetable
  • 12,594
  • 8
  • 50
  • 82

1 Answers1

2

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)

  • set_note_attachment doesn't appear to be in the API I have access to. I am using Suger version 6.5, does that make a difference? – BlackVegetable Aug 15 '12 at 14:48
  • I haven't got a 6.5.x installation, but according to the documentation (http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_6.5/02_Application_Framework#SOAP), the method should exist. – Kåre Werner Storgaard Aug 16 '12 at 06:30
  • You were totally correct. I was using some wrapper classes provided by another developer and he did not implement a wrapper for `set_note_attachment`. However, I went ahead and implemented it and it works like a charm. Thank you again! – BlackVegetable Aug 16 '12 at 13:42
  • Do you know if these methods work with a custom file module/how do you upload the file via rest for a custom file module? – Daniel Jonker Dec 10 '12 at 03:23