Hi
I'm trying to download CSV file from SL
if (printCSV == 'T') {
var csvData = createCSVString(context);
var fileName = 'CSV FILE.csv'
var fileCsv = file.create({
name: fileName,
fileType: file.Type.CSV,
contents: csvData,
encoding: file.Encoding.UTF_8
});
log.debug('fileCsv', fileCsv);
log.debug('fileCsv.getContents()', fileCsv.getContents());
context.response.writeFile(fileCsv);
}
file obj and Content is ok but it is downloading the wrong data in csv file
<!DOCTYPE html>
html lang="en"headmeta http-equiv="Content-Type" content="text/html; charset=UTF-8" /meta http-equiv="X-UA-Compatible" content="IE=edge"script type="text/javascript"
" window.headerstarttime = new Date();"
" /script"
titleCustomer Item Tracker - NetSuite UK (Berwick Care Equipment Ltd)/title
<link rel='stylesheet' href='/core/
b
borncorp
02/19/2024, 5:31 PM
Try using fileType Text
borncorp
02/19/2024, 5:32 PM
If that doesn't work then that file is HTML so open it on a browser and check what it shows
s
Sagar Hiray
02/21/2024, 4:57 AM
Thanks for response
Actually, I'm using writeFile and writePage simultaneously, that's why.