Mass importation of attachments

I have been looking but not found a good way to do this. We came from salesforce and have about 3,000 attachments that we would like to import and attach to the customers. What would be the best way to go about uploading and connecting them to the customers?

I’m not sure what exactly your attachments are, but if you want to do it with SuiteCRM concept of “Documents”:

I tried creating a document attached to a contact, and went into the database to see what had been created, it seems to work like this:

There’s a table in the database with the relationship between documents and contacts, called “documents_contacts”

Here you find the id of the contact and of the document (tables “contacts” and “documents”)

Then, in the “documents” table, you need an extra level of “document revision”, that’s what gets stored as a file: it’s a specific revision.

There will be a file in your upload directory whose name is exactly the id of that document revision (e.g. something like 85c2ee00-a1ce-3c59-55bb-572397afb36e)

The file name as visible to the user (like “php.ini”) will be stored in the “documents” table, but not on the file system. Only ids of revisions are used on the file system.

So, to do your big import in order, you would:

  1. upload all files to the upload directory with id-like names
  2. Create a line for each with those id-like names stored as revisions in table “documents”; create another id for the document itself
  3. Make the appropriate association in the “documents_contacts” table linking the contact-id with your document-id.

BTW - don’t trust my answer without checking, I just learned all this right now. : - )

Search online for what kinds of values you can use for new ids in SugarCRM, I think you are free to select anything unique to that table, but you need to check that. Good luck.

Thanks for your suggestions, some things have come up so I won’t be able to attempt them until monday or tuesday but I will let you know what the results are.

I have mostly txt files as attachments but there is a decent number of .exe files and pdf’s as well.

Thanks again.

I think the best way for this is :

How is stored Account Name or Contact Name is salesforce (Customer) ? How know witch ( customer ) account or contact relate document ?


If you’re going to code it in php, you can just use the Beans directly, no need to go through a WebService if it’s not remote.

Also, for the txt files you can consider inserting them into the Contact’s description field (if you think that’s appropriate for your case), or as Notes, not Documents. This way it’s simpler and easier to access.

About your question regarding Contacts and Accounts, I don’t fully understand your question. Do you already have Contacts and Accounts created in SuiteCRM? Or are you just starting everything?

Hi pgr

As you can imagine, 3000 attachments is not for one customer but X attachments is for 1 customer, Y attachments is for another customer…and so
If the salesforce export all … with code, we can push with web api to suitecrm.
Maybe another tool exist like talend, or

I will be taking a look at your solution in greater detail a little later this week as I currently have a few more pressing matters.
There is an export from Salesforce that lists every attachment and the id for each account it belongs to which I can easily map…

In this case attaching them in description/notes will not work as they are mostly logs, some with up to 500,000 characters in length.

My customers have already been imported, there are about 20,000 of them and of those the 3,000 attachments belong to about 1,700 of them.

I won’t have time to try any of this until at the earliest tomorrow, I will update this thread when I find anything out.

Yes, for that kind of thing Notes are not appropriate, Documents are probably what you need. An additional insight is that, if most of your files are big text files, you could try to find a convenient format that is compressed (like docx which is an open standard, despite being invented by Microsoft), it would save you tons of disk space.

To import, I would say definitely the way to go is a PHP script that works with Beans (not WebServices). I am doing a similar import myself.

I recommend Jim Mackin’s eBook on SuiteCRM for Developers, you’ll find what you need there, in simple explanations.

Thank you for your recommendation, I will take a look when time permits. Luckily not all of these text files are large, but enough that it would become an annoyance to filter them out and attempt other methods for the rest, not to mention I have more than just text files. As such, the entire folder of attachments is only around 500mb, so storage is not a huge concern.

Just for the sake of completing (and maybe even correcting) the information in this thread, I realized that “Notes” not only have a text that you can fill, they also allow file attachments.

In fact, the way that SuiteCRM handles email attachments is by creating a “Note” and linking it to the email.

So, instead of loading your attachments into “Documents”, it is simpler to load them into “Notes”. You lose the ability to keep track of several versions of each, but if your attachments are static then you don’t need that ability.

More on this here:


Could you please tell me how to mass import (bulk) attachment in notes