I am trying to create a CSV in the batch.
global void finish(Database.BatchableContext BC)
{
for(ID a: temp)
{
String recordString = '"'+a+'"\n';
finalstring = finalstring + recordString;
}
Blob csvBlob = Blob.valueOf(finalstring);
}
I'm able to form the CSV file, but the first record has extra characters added to the value like this:
null"001R000001dasdsadU"
I'm sure recordString has issues. How should I escape in a string?