Guidance on importing notes with attachments

Hello -

We're converting data in the Sugar Cases module. Rather than try convert all the detailed messages back and forth between us and a customer on a single case, we're going to create a PDF of all the activity from the legacy system.

Then we'd like to IMPORT the Case information - and then import a PDF for each one into a Note/attachment.

Importing the basic NOTE isn't a problem. But we can't find any detail - either in the manuals or in the community - about how to import/relate the attachments.  We found the information that says the attachments are in the /Upload/ folder and that Sugar gives them the same GUID as the Note they're attached to.  But that's where things stop.  We obviously don't want to put 5,000 PDF files in the /Upload folder and then go manually rename them with GUIDs after we upload their related Notes.

Can anyone point me towards the solution.  I can't help but think that I've missed something in the Admin guide or other documentation.

Thanks very much.

Parents
  • Hi Bob Bundy 

    The files attached in the Notes can not be imported at all, instead you need to copy the PDFs files into folder upload/ ($sugar_config['upload_dir']). The name of the target file to be related to a given Note MUST be exactly the "id" of that Note.

    On importing Notes you must make sure you properly populate the fields file_mime_type, filename, file_ext and file_size.

    Basically you need to prepare the import csv according to those fields, from related files. Then you need to import the Notes, fetch theirs IDs and finally copy the files into upload/ folder accordingly.

    Good luck!

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Hi André Lopes,

    Thank you. It's been several years since I worked on Sugar - but you helped me before. I'm glad to see you're still here and appreciative of your help.

    I understand everything you said. The part I'm having difficulty with is the naming of the attachments. I realize each document file must be named with the ID of the parent note.  But do I have to manually change the names of all those files? 

    Let's say the files are called PDF1.pdf, PDF2.pdf, etc.  I can't rename them until the notes are imported into Sugar and I get their IDs.  So I import the notes and get their IDs of 5,000 notes.  I copy the attachment files to the /Upload folder.  Do I have to manually rename each attachment file with the ID from its corresponding note?  If so, that will be a nightmare.

    Thanks again for your help!

    Bob 

Reply
  • Hi André Lopes,

    Thank you. It's been several years since I worked on Sugar - but you helped me before. I'm glad to see you're still here and appreciative of your help.

    I understand everything you said. The part I'm having difficulty with is the naming of the attachments. I realize each document file must be named with the ID of the parent note.  But do I have to manually change the names of all those files? 

    Let's say the files are called PDF1.pdf, PDF2.pdf, etc.  I can't rename them until the notes are imported into Sugar and I get their IDs.  So I import the notes and get their IDs of 5,000 notes.  I copy the attachment files to the /Upload folder.  Do I have to manually rename each attachment file with the ID from its corresponding note?  If so, that will be a nightmare.

    Thanks again for your help!

    Bob 

Children