function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anup JadhavAnup Jadhav 

Can we store a file (xml or csv) to a server using Apex?

Hi all,

 

We have a requirement to create an xml file in Apex, and store the file on an external server. Creating an xml file is a no-brainer, but I haven't figured out if it IS possible in Apex(and on Force.com platform) to store the file to a folder on an external server.  I do not wish to create an external webservice(in Java or C#) if possible.

 

Any advice on implementation will be greatly appreciated.

 

Thanks in advance!

 

- A J

bob_buzzardbob_buzzard

It certainly possible, but it all depends on how your external server can accept information.  E.g. you could probably make and HTTP post request and upload the file that way if your server can receive in that fashion.

Afzal MohammadAfzal Mohammad

You have another option of attaching your xml doc to an email and send it as an email from apex. I my case, I had saved docs from salesforce to sharepoint's list, in this fashion.

 

Hope that helps.

 

Afzal

SFDC_WorksSFDC_Works

Hi Bob...

 

Can u tell me how can make http request and send the data to server. And even if i send it, should i need to have some code to accept and store it???

 

the solution told by you is somewat confusing me.