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
Abhishek Pal 33Abhishek Pal 33 

How to write data in csv?

Hello Everyone,

I am stuck at one point that My requirement is that I want to write data in csv once my record in inserted successfully in salesforce or failed. For eg: there is column in csv (Flag) I want to make it true when record in inserted succcess.

Thanks in advance.
Vasani ParthVasani Parth
Abhishek,

What tools are you using to import the data?

 
VineetKumarVineetKumar
Refer this post : similar question has already been answered here with apex code:
https://developer.salesforce.com/forums/?id=906F000000090JcIAI

Let me know if this helps.
Abhishek Pal 33Abhishek Pal 33
Hi Parth,

I am using document object to read the csv files which is uploaded in a  shared folder.
VineetKumarVineetKumar
You need to query on the document and get the body of it in string format, and manipulate it as per your requirement.
Help link : http://sfdcsrini.blogspot.com/2014/04/how-to-read-csv-file-from-apex_17.html