I need the object in the <Netsuite2.com> DB that h...
# ask-stanley-ai
j
I need the object in the Netsuite2.com DB that hosts the relationship between the transaction and the file cabinet file. transaction: is the table of transactions at header level. file: is the table that relates the files. There must be some many-to-many entity, intermediate, that has these equivalences because a document can be in one or many transactions. In the Oracle documentation, this relationship is not found, nor is it in the transaction table.
c
AI generated answer (using internal Slack threads):
In NetSuite, the relationship between the transaction and the file cabinet file is not directly visible or accessible via the UI or SQL. However, you can use SuiteScript to create a search that joins transactions with their file attachments. Here's an example of how you can do this:
Copy code
javascript
const tranId = '123456';

const salesOrderSearchObj = search.create({
    type: 'salesorder',
    filters: [
        ['internalid', 'anyof', tranId],
        'AND',
        ['type', 'anyof', 'SalesOrd'],
        'AND',
        ['mainline', 'is', 'T'],
    ],
    columns: [
        search.createColumn({
            name: 'internalid',
            join: 'file',
            label: 'Internal ID',
        }),
        search.createColumn({
            name: 'name',
            join: 'file',
            label: 'Name',
        }),
        search.createColumn({ name: 'tranid', label: 'Document Number' }),
    ],
});
const searchResultCount = salesOrderSearchObj.runPaged().count;
log.debug('salesOrderSearchObj result count', searchResultCount);
salesOrderSearchObj.run().each(function (result) {
    return true;
});
This script creates a search on the 'salesorder' type, filters by the transaction ID, transaction type, and mainline, and then creates columns for the internal ID and name of the file, as well as the document number of the transaction. The search results will include all transactions that have a file attached, along with the details of the attached file. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.842077136
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.816558957
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.812958777
Please provide your feedback on this answer.