convertToCSV
# suitescript
z
convertToCSV
m
You will run into issues with this if your fields have any commas or line breaks. What I do which works well is double quote each field and escape double quotes in fields.
Copy code
row = row.map(function(field) {
  return '"' + field.toString().replace(/"/g, '""') + '"';
});
response.write(row.join() + '\n');