Create new empty attachment, with no content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2025 09:36 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2025 09:53 AM - edited 09-17-2025 09:59 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2025 10:43 AM
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);
