How to obtain note attachments (Files) directly?

Hello

I am trying to build a Pentaho ETL job that run a SQL query that will return the id’s of some Notes objects.

The idea is to try to download the file attached to each Note and assign the Account name (the one related to the note) as name of the file.

My problem is that I dont know how I can get to the file stored in the “upload” folder where the attached files are .

In the past with SugarCRM you could download the file by introducing the URL “http://serverURL/upload/note_id” where note_id is the id of the note that has the file attached.

I see that with SuiteCRM this method is not valid, so my question is to check if there is any way (url, api rest…) that I can use to download the file attached from a Note from any URL or POST method ???

Thanks a lot in advance!

Just use the same URL that you find in the UI when it gives you the link to the file. Here is an example from the online demo:

https://demo.suiteondemand.com/index.php?entryPoint=download&id=285b11f0-d694-dc74-279f-65e7a474f3a7&type=Notes

It has to go through an entry-point, and you must be authenticated.

Thanks a lot!. It seems that I am close already!.

Just a quick question please. I am designing the pentaho job to download the notes (Once I get their Id’s from a query) I must download using this HTTP call. To do so I am using the step “HTTP” to connect to the URL and download the note file to a target destination.

I am able to connect to the URL of the web server, and logs show that the file is downloaded. Even when I go to the destination folder the file is in there. The problem is that the file created in the destination folder is only 14 KB and I am not able to open it as I get an error saying that the file must be in wrong format.

If I connect to the URL using Chrome, Firefox… the file gets downloaded and it is 850KB and I am able to open it with no problem.

Is there any step that I must be configuring wrong in this task . Could it be that something in the web server is preventing to download the file correctly using this pentaho job instead of doing it manually??

Please let me know if something comes to you mind!. Thanks a lot.

Try opening that file in a text editor, or changing its extension to html and opening in a web browser. My bet is that your are getting an HTML response instead of the file. This would mean that your process to retrieve the file is not correct yet. But we can’t help with that, unless you provide more details…

Hi, thanks for the advice.

I have changed the extension to “.html” and I can see what it is being downloaded is the login page of SuiteCRM.

My first thought was that I was introducing the login credentials in the HTTP pentaho step wrong, but after reviewed them all parameters are correctly set. Here is an example

URL :http://ipaddress/index.php?entryPoint=download&type=Notes&id=36253dd7-3f90-8a8b-0b0f-65f0275b4940
TARGET_FILE: C:/Downloads/file.pdf
Login: admin
Password: Password_word

If I introduce the URL in the browser directly, the note is downloaded with no problem, but using pentaho I get this html file (see attachments)

Any ideas or suggestions please?

Thanks once more!


I have no idea about Pentaho, but normally these things require that you set the type of HTML request being done - either PUT or GET or POST. You need to get this right.

Your pentaho is not logging in the way Suite requires. Your Pentaho “transfer a file using HTTP” is sending a standard “HTTP authentication” which is totally different.

Hello Chris

This was also my thought, however dont know how to solve it. In the “transfer a file using HTTP” task dont see any other way to run the authentication.

Any ideas or suggestions?

Will keep playing around!.

Cheers

You need to do the type of login described here: