The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Create new empty attachment, with no content

Ram_n Botelho
Tera Contributor

Hi.

I am trying to create a new empty file, with no content, but the following method only works if content is filled.

Does anyone have any idea of how can I get it, please?

 

var attachment = new GlideSysAttachment();
attachment.write(grTask, fileName, 'text/plain', content);
2 REPLIES 2

Brad Bowman
Kilo Patron
Kilo Patron

I have gotten this to work using ' ' (one space) as the final argument.  There's probably a Business Rule, System Property, or check in the script method preventing 0 byte file sizes.

Rafael Batistot
Kilo Patron

hi @Ram_n Botelho 

If you really want to create a file with no content (0 bytes), you can do it like this:

 
var attachment = new GlideSysAttachment();
var emptyContent = ''; // nothing inside
attachment.write(grTask, fileName, 'text/plain', emptyContent);