Sugar Cloud - how to create a file (csv) from Sugar and push it to an external program using FTP

Hello,

we have more and more customer that go to Sugar Cloud Edition.

According to this documentation :  https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_9.3/Architecture/Module_Loader/Module_L… we don't really understand how, with Sugar Cloud restriction, we can create a job that

  • query some Sugar records : OK
  • create a CSV file to store the selected records : WHICH METHOD CAN WE USED ACCORDING TO CLOUD RESTRICTION ?
  • push the created file using FTP : seems that PHP FTP methods are allowed

Is one of you aware of that and how we can solve this issue ?

Kind regards,

Frédéric

  • Hi Groupe Sugar,

    For CSV related operations (reading, writing etc.), you can use parsecsv library inside vendor/parsecsv/php-parsecsv.

    You can checkout the sample codes inside examples directory in vendor/parsecsv/php-parsecsv/examples on how to use it.

    For pushing the file to FTP, you can use the basic curl.

    Let us know if this helps.

  • Thank you hats for your answer, even if, in my understanding, it sounds more like a trick / workarround that an official / recommended way to do that.

    We test it and it works fine ; we are just scared that, if Sugar change the library or something similar, it won't work anymore.

    Moreover, we also need, for other project, to create different kind (PDF, DOCX etc.) of documents and then it sounds even more like a trick.

  • You can use the default splFileobjects in php without issue. As long as you use the default namespace ( \) it works. Also you need to take into account to clean the files up after you've uploaded them. If you want to generate documents based on your data in SugarCRM I thinkg it's best to search for commercial solutions that could do this based on the api layer of sugarcrm