writeTXTfile

I want to keep a log that shows who I’ve sent an email to and at what date/time. The writeTXTfile works, but I’m having trouble producing a carriage return after reading the first string into the text file. From my understanding, writeTXTfile creates a new file, instead of retaining the contents of the original file. That’s why I use readTXTfile and store the string in a variable.

plugins.file.writeTXTFile( installdir + fname,  filecontents + '\r\n' + forms.frm_invoice.record_number + ' ' + new Date() + ': Emailed invoice to ' + forms.frm_invoice.email)
}

Much help will be greatly appreciated

new line character is os dependant; for me ( on windows ) it works with \r\n . you can try this code:

var fileNameSuggestion = 'mytest.txt'
var textData = plugins.file.readTXTFile( fileNameSuggestion)
var success = plugins.file.writeTXTFile(fileNameSuggestion,textData+ Packages.java.lang.System.getProperty("line.separator") + 'new line');