You need to sign in to do that
Don't have an account?
Cool_Devloper
Creating a CSV file from salesforce and sending to FTP server
Hello Friends,
I have a requirement wherein the users will click on a button and a CSV file should be generated with some data. Now this file should be automatically sent to an FTP server in real time.
Can this be achieved in salesforce by any means?
Please Help!
Cool_D
Thanks sfdcfox for the elaborate explanation :)
I just wat to understand how this thing actually works. Like, when i make a HTTP Post to a server, is the complete file transferred over the wire?
How does the server save the attachment fetching it from from salesforce? And if this is possible, then do i need to send the attachment link to this server?
Many Thanks,
Cool_D
This requires two components that would work in tandem. First, you need an appropriate Apex Class that can perform the transfer. This utilities the Http, HttpRequest, and HttpResponse objects. The "method" would be set to "POST", the endpoint would be set to your server's URL, and the Body would be set to the CSV string you are sending (or Base64, if you prefer). The second part would be a service hosted on your web server that accepts the file (i.e. http://www.mycompany.com/cgi-bin/fileupload.php). You may provide authentication if you prefer (to prevent abuse, DOS attacks, etc). The pseudocode would be as follows:
1) Query for the selected items.
2) Construct the CSV string.
3) (Optional) Convert to base64.
4) Construct the connection, and send the file, using whichever authentication you prefer.
5) (Optional) Read the response to ensure a successful transfer.
The server side would be as follows:
1) (Optional) Verify authentication.
2) Read from the standard input stream until all bytes are transferred.
3) Save the file to the storage medium, or transfer it via FTP to the final destination.
4) Provide some type of response.
Ultimately, the specifics of the entire process will depend on your server's capabilities as well as the skills of you or your web developer.
I do understand this after the elaborate explaination!!
So, basically here we are calling a service over a server which will save the file for us.
Is there any other way apart from using a Webservice to do this file transfer?? You know the limit is 100KB and unfortunately the size of attachments in this case is huge! :(
Cool_D
Hi sfdcfox,
I need to construct a CSV file with APEX and am a bit new to the game. Do you have any sample code I could get started with, or resources that you can point me to?
Thanks in advance.
Can you please explain about below things with sample code:
FYI, i am able to construct the CSV string and
tell me about connection construction ...etc as you mentioned like: in 4th and 5th step( How i ensure,whether my data is transfered successfully or not..
4) Construct the connection, and send the file, using whichever authentication you prefer.
5) (Optional) Read the response to ensure a successful transfer
The server side would be as follows:
1) (Optional) Verify authentication.
2) Read from the standard input stream until all bytes are transferred.
3) Save the file to the storage medium, or transfer it via FTP to the final destination.
4) Provide some type of response.
What are the various approaches to send extracted CSV file from Salesforce to Dropzone via SMS(Internal ETL) step by step- New to SFDC:( Pls help
I'm new to salesforce. Please help me with the data extract process in salesforce.
Task: Send extracted data to Dropzone nightly via SMS(Internal tool).
What steps do i need to perfrom in salesforce to do this?
I know to extract data from salesforce and save it in CSV format on desktop.
What do i do next to send this file to dropzone?
Develop a code? I heard this can be done using Data loader command line. Not sure where to start. Appreciate if someone can help me with detailed steps.
Thanks!
http://www.equifax.com/businessconnect/documents/FTPConnectUserGuide.pdf
With this tool, you can create batch jobs that can stream csv or other formats to Secure FTP (SFTP) sites. The tool gives you several encryption options. It also provides an API you can call from Apex to drop files onto an SFTP site in any creative way you want.
Note that the tool does not currently support unsecure FTP or FTPS.
I also have same problem right below.
Can anybody know the right solutions?
Does anybody know how to connect SFDC with FTPS server?
Our goal is like below.
- All attached file should be stored into FTPS server with SSL.
- Files can't be stored in SFDC server, because of security issue.
- FTPS server is located on the inside of firewall and DMZ.
- We only need to connect FTPS server with SFDC.
- Our customer doesn't want to spend their money for FTP connection, and they have a FTP server now.
We tried to use trial version of many FTP apps from app exchange, such as "FTP ATTACHMENTS", "X files Pro", "Cloud files", but all are paid apps for our requests.
If somebody knows the proper app and how to do it, please give me a advice!
Thank you in advance!
FTP API: https://ftp-api.herokuapp.com/
Blog Post: https://medium.com/@adarshsharma.jaipur/how-to-use-ftp-server-using-rest-api-8d1b3f88de0
Please let me know if you need any other information.