Elaine L
02/18/2026, 1:48 AMCeligo AI
02/18/2026, 1:48 AMAI generated answer (using internal Slack threads):In SuiteScript, you can replace the contents of a file without deleting the record by creating a new file with the same name, type, and folder. The old file will be automatically replaced by the new one. Here is a sample code snippet that demonstrates this:
javascript
var fileType = file.Type.PLAINTEXT;
var folder = <FOLDER ID>;
var name = 'test.txt';
file.create({ fileType: fileType, folder: folder, name: name, contents: 'First' }).save();
file.create({ fileType: fileType, folder: folder, name: name, contents: 'Second' }).save();
file.create({ fileType: fileType, folder: folder, name: name, contents: 'Last' }).save();
In this example, the file 'test.txt' in the specified folder will end up containing only the last saved contents, 'Last'.
Please note that there can be browser caching issues that might cause some users to see the old version of the file if they opened it before the overwrite happened. Clearing the browser cache usually resolves this issue.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
02/18/2026, 1:48 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.82043463
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.808532715
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.806274414
Celigo AI
02/18/2026, 1:48 AM