What?
A super quick article on something that almost deserves its own article: using new lines in ZohoDeluge.

Why?
My use-case here is that I was generating a comma separated values (CSV) file given some lists and strings and although the same code worked great on one Zoho CRM, another client's ZohoCRM was not accepting "\n" as a new line character and instead would render/display it as "\n"...

What I have
Me,Myself,I\na,b,c
What I want
Me,Myself,I
a,b,c

How?
So in this article I just want to list some various methods of inserting a new line character.

Works on most systems:
l_CsvFileRows = List();
l_CsvFileRows.add("Me,Myself,I");
l_CsvFileRows.add("a,b,c");
//
v_CSVFilename = "Test.csv";
f_CSVFile = l_CsvFileRows.toString("\n").toFile(v_CSVFilename);
//
// sometimes works but sometimes yields:
// Me,Myself,I\na,b,c

Works on systems where the above doesn't work:
l_CsvFileRows = List();
l_CsvFileRows.add("Me,Myself,I");
l_CsvFileRows.add("a,b,c");
//
v_CSVFilename = "Test.csv";
f_CSVFile = l_CsvFileRows.toString(zoho.encryption.urlDecode("%0A")).toFile(v_CSVFilename);
//
// yields:
// Me,Myself,I
// a,b,c

Additional
  • Adding to a screen output: eg. a button response or response of info: try holding down the ALT key and pressing 255, then releasing the ALT key and save the change to your code. This will not display a character but is a new line...
  • Used in certain cases
    v_NewLineChar = hextoText("0A");
  • Thought I needed to add the following but this makes absolutely no difference:
    f_CSVFile.setCharSet("UTF-8");
    f_CSVFile.setFileType("csv");