Aaron McCausland
07/28/2026, 3:24 PMCeligo AI
07/28/2026, 3:24 PMAI generated answer (using internal Slack threads):In order to get the files sublist in Client SuiteScript on a transaction that is being created but has not been saved yet, you can use the
getLineCount method with the sublistId 'mediaitem'. This will allow you to access the files attached to the record.
Here is a sample code snippet:
javascript
var fileCount = record.getLineCount({sublistId:'mediaitem'});
for (var i = 0; i < fileCount; i++) {
var fileId = record.getSublistValue({
sublistId: 'mediaitem',
fieldId: 'file',
line: i
});
// Do something with fileId
}
In this code, record is the transaction record that is being created. The getLineCount method is used to get the number of files attached to the record. Then, a loop is used to go through each file and get its ID using the getSublistValue method.
Please note that this code should be executed in a client script or user event script where the record is being created but not saved yet.
******
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
07/28/2026, 3:24 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.830871642
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.829712033
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.829467833
Celigo AI
07/28/2026, 3:24 PM