Multi-Book Accounting Transaction
This topic applies to all versions of SuiteScript.
If your account has the Multi-Book Accounting feature enabled, you can use SuiteScript to search for transactions using accounting book as a search filter or a search column. To execute this type of search, you use the multi-book accounting transaction search record.
In the UI, you can view the multi-book accounting transaction search by going to Reports > New Search and clicking Multi-Book Accounting Transaction.
For help working with this record in the UI, see Multi-Book Accounting.
The internal ID for this record is accountingtransaction. Note that this record is a search record only. You cannot create or copy this record.
See the SuiteScript Records Browser for all internal IDs associated with this record.
For information about using the SuiteScript Records Browser, see Working with the SuiteScript Records Browser in the NetSuite Help Center.
For information about scripting with this record in SuiteScript, see the following help topics:
Supported Script Types
The multi-book accounting transaction record is supported in both client and server SuiteScript.
Supported Functions
Only search is supported for this record.
Sample Code
The following sample shows how to search for a specific transaction and include in the results details about the transaction's accounting book and foreign exchange rate, among other data.
/**
* @NApiVersion 2.1
*/
define(['N/search'], (search) => {
/**
* Displays up to 4,000 accounting rows using browser alerts.
* Requires the Multi-Book Accounting feature in the target account.
* @param {number|string} [transactionId=18] Transaction internal ID.
* @returns {number} Number of rows displayed.
*/
const showTransactionResults = (transactionId = 18) => {
const mySearch = search.create({
type: 'accountingtransaction',
columns: [{
name: 'accountingbook',
sort: search.Sort.ASC
}, {
name: 'line',
join: 'transaction',
sort: search.Sort.ASC
}, {
name: 'account'
}, {
name: 'amount'
}, {
name: 'exchangerate'
}],
filters: [{
name: 'internalid',
operator: search.Operator.ANYOF,
values: transactionId
}]
});
let index = 0;
mySearch.run().each((result) => {
const recordId = result.id;
const recordType = result.recordType;
const book = result.getValue({ name: 'accountingbook' });
const line = result.getValue({ name: 'line', join: 'transaction' });
const account = result.getValue({ name: 'account' });
const amount = result.getValue({ name: 'amount' });
const fxrate = result.getValue({ name: 'exchangerate' });
alert(`${index}: ${book} | ${line} | ${recordId} | ${recordType} | ${account} | ${amount} | ${fxrate}`);
index += 1;
return true;
});
return index;
};
return { showTransactionResults };
});