12

My question is how I can intergrate Salesforce with different FTP servers in real time. I have read some articles about it, but to be absolutely sure I thought it would be a good idea to post a question here.

I want to be able to send and receive data from Salesforce as a csv file to a ftp server. How I'm thinking about doing this is listed below.

Send the data:

Create a apex class which query the necessary data in Salesforce and create a csv file. I guess this is trivial? Then send the file to a web service created in Salesforce, just by calling it in the apex code. Create a web service in Salesforce which receives the data from the apex code. This web service should in some way send the data to the appropriate ftp server. I guess I can simply modify some of the code provided by Salesforce to make this work? The file is sent. Receive the data

This one is a bit trickier. I guess I have to pull the data from the FTP server by using my web service, which then send the file collected to the appropriate apex class. Or, the FTP server could send the data to the SFDC web service, I don't know if this is possible? The web services on the other side that sends the data to the ftp server, could send it directly to the SFDC web service, which then again forward it to the apex class. I guess the web service will use the remote site url to connect to the SFDC web service?

3
  • Do you want to migrate data from one SFDC org to another?
    – Mahmood
    Dec 2 '14 at 11:47
  • Have you tried to do it with Jitterbit Data Loader? Dec 2 '14 at 12:01
  • Yes, later on I want to migrate data from one SFDC org to another, but not for this topic @MahmoodButt. Our client do not want to use Jitterbit Data Loader because they find it expensive.
    – ttveten
    Dec 2 '14 at 12:04
14

Through the salesforce service (Apex or others) you cannot directly communicate with an FTP server (either upload or download).

Your best bet would be to use an external application. Jitterbit Data Loader is the go to application for FTP interactions with salesforce.

You could also create your own service outside of the salesforce platform.

2
  • 2
    Using Jitterbit you can query the data source, extract that to a file on a schedule and use command line to zip it up and upload it to a SFTP site. It is a lot easier than trying to set up the Salesforce.com Dataloader to work via Command Line.
    – Eric Clay
    Dec 3 '15 at 20:43
  • How can I create a webservice outside Salesforce to achieve it. In our usecase, we don't have the budget to use any third-party tool like Jitterbit, so I have to achieve it via code only.
    – Student
    Sep 11 '19 at 23:39
1

We have implemented a REST API which allow to directly communicate with an FTP server. This FTP API is designed for people who need to perform actions like DOWNLOAD, UPLOAD, DELETE and TRANSFER on the FTP server using REST API’s.

Here we are addng API documentation and blog post link.

FTP API: https://ftp-api.herokuapp.com/

Blog Post: https://medium.com/@adarshsharma.jaipur/how-to-use-ftp-server-using-rest-api-8d1b3f88de0

1
  • Hi Adarsh, your api returns System.HttpResponse[Status=Service Unavailable, StatusCode=503] for any call other than Authentication
    – umithuckan
    Feb 12 at 20:05
0

A third-party tool Skyvia allows us to export and import CSV files between Salesforce and FTP, that's how: Using an Export package, we export Salesforce data to FTP (it exports a table or multiple tables as separate CSV files to an FTP server) Then, using an Import package, we load data from CSV files hosted in FTP to Salesforce. In this step you can map columns from a CSV file from FTP to the corresponding columns in the Salesforce table. You can schedule both these packages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.