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
Kiran Kumar GottulaKiran Kumar Gottula 

attaching a file through developer console

Hi frndz ! 

                      How to upload a content document file in any object through only developer console.

 

                      Please help me that code.

Thomas DvornikThomas Dvornik

What is the use case for uploading document files through the developer console?

Rahul Garg SFDRahul Garg SFD
For all those who are looking for the answer of this question.
Try the below code :-

 Attachment attach =new Attachment(Name='newFile.csv'); //newFile is the name of the downloaded file and csv is its extention of file
 attach.Body=Blob.valueOf(csvString);                             // csvString is the file in String format
 attach.ParentId=myObj.id;                                               // myObj.id is the ID of the Parent Object ()
 insert attach;                                                                   // insert 'attach' as we need to create a new object everytime.