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
chandraYeruvaRechandraYeruvaRe 

Uploading a pdf/text file in salesforce.com

Hi ,

 

I have developed a web service using apex code and succesful to invoke it using soap Client.

Now I have one new requirement to upload a file to the custom object. how do I upload a pdf/text file to the custom object from my local file system.Is there any way to do this ? Help Appreciated.

 

Thanks

Chandra.

SuperfellSuperfell

You'd want to create an attachment object, and set its ParentId to the Id of the custom object row, no need for apex, this is easily done through the regular enterprise/partner APIs, something like

 

 

Attachment a = new Attachment();

a.setParentId("A0A....");

a.setContentType("application/pdf");

a.setBody(loadFileAsBytes());

a.setName("my attachment");

SaveResult [] sr = binding.create(new SObject [] {a});

 


 

Message Edited by SimonF on 04-04-2009 07:39 PM
Message Edited by SimonF on 04-04-2009 07:40 PM
Message Edited by SimonF on 04-04-2009 07:40 PM
chandraYeruvaRechandraYeruvaRe

Hi Simon,

 

If I want to create a seperate folder and put some documnets (pdf docs in it ) does I need any special permissions.I went through one of your http://community.salesforce.com/sforce/board/message?board.id=JAVA_development&thread.id=5574 replies and tried to create the folder and was unsuccesful.I was only having only Mileage folder in folders.If i want to create a Folder "MyPdfs" how can i do that? Your help appreciated.

 

Thanks

Chandra.