Milcho Dimkov
04/21/2025, 5:00 PMCeligo AI
04/21/2025, 5:00 PMAI generated answer (using internal Slack threads):Based on the conversations, it seems that you can't directly get the list of files attached to a transaction using a simple SQL or SuiteTalk. However, you can achieve this using SuiteScript. Here is a simple Suitelet example that can list the file names attached to the communication tab for a given transaction id:
javascript
/**
* @NApiVersion 2.x
* @NScriptType Suitelet
*/
define(['N/search', 'N/file', 'N/record'], function(search, file, record) {
function onRequest(context) {
if (context.request.method === 'GET') {
var transactionId = context.request.parameters.id; // get transaction id from request parameters
var transactionRecord = record.load({
type: record.Type.SALES_ORDER, // replace with your transaction type
id: transactionId
});
var numLines = transactionRecord.getLineCount({
sublistId: 'recmachcustrecord_file'
});
var fileNames = [];
for (var i = 0; i < numLines; i++) {
var fileId = transactionRecord.getSublistValue({
sublistId: 'recmachcustrecord_file',
fieldId: 'custrecord_file',
line: i
});
var fileObj = file.load({
id: fileId
});
fileNames.push(fileObj.name);
}
context.response.write({
output: fileNames.join(', ')
});
}
}
return {
onRequest: onRequest
};
});
This Suitelet loads the transaction record using the provided id, then iterates over the 'recmachcustrecord_file' sublist (which contains the attached files) to get the file ids. It then loads each file to get its name. The file names are returned as a comma-separated string.
Please replace 'SALES_ORDER' with your actual transaction type and 'recmachcustrecord_file' and 'custrecord_file' with your actual sublist and field ids.
******
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
04/21/2025, 5:00 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.814378142
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.797291756
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.792553365
Celigo AI
04/21/2025, 5:00 PM