Hi I'm trying to download CSV file from SL if (pri...
# suitescript
s
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" head meta 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
Try using fileType Text
If that doesn't work then that file is HTML so open it on a browser and check what it shows
s
Thanks for response Actually, I'm using writeFile and writePage simultaneously, that's why.