createNewTransaction()
Function Declaration |
|
Type |
Object function |
Description |
Add a new imported transaction to the account data set. |
Returns |
void |
options is a JavaScript object with the following input parameters:
Parameter |
Type |
Required |
Description |
Since |
---|---|---|---|---|
date |
String |
Yes |
The date of the transaction. NetSuite currently accepts the ISO 8601 extended local date format. |
2020.2 |
amount |
Number |
Yes |
The amount of the transaction. |
2020.2 |
transactionTypeCode |
String |
Yes, for bank reconciliation |
The raw bank transaction code NetSuite uses to map to a valid bank data type in NetSuite. You can set a transaction code from the Code Type Mapping subtab on the Format Profile page, or through SuiteScript using the getStandardTransactionCodes(context) interface function. |
2020.2 |
uniqueId |
String |
No |
The unique identifier of a transaction, which is used to detect duplicate transactions. The uniqueId automatically prevents a transaction from getting imported into NetSuite as a duplicate. |
2020.2 |
id |
String |
No |
The transaction number. For example, a cash sale transaction could have a transaction number of CS0001. |
2020.2 |
payee |
String |
No |
The payee to whom the transaction is being sent. |
2020.2 |
currency |
String |
No |
One of the standard currency codes to which the user has access. |
2020.2 |
memo |
String |
No |
The memo of the transaction. |
2020.2 |
transactionStatus |
String |
No |
The status of the transaction. |
2020.2 |
customerReferenceId |
String |
No |
The customer ID for the transaction. |
2020.2 |
customerName |
String |
No |
The customer name for the transaction. |
2020.2 |
invoiceReferenceIds |
Array[String] |
No |
The list of invoice reference numbers for the transaction. |
2020.2 |
billedTaxAmount |
Number |
Yes, for employee expenses |
The amount of the billed tax in the account's billing currency. |
2020.2 |
localChargeAmount |
Number |
Yes, for employee expenses |
The transaction amount in local currency. |
2020.2 |
localTaxAmount |
Number |
Yes, for employee expenses |
The amount of the billed tax in local currency. |
2020.2 |
currency |
Number |
Yes, for employee expenses |
The exchange rate between local currency and the account’s billing currency. The exchange rate on the transaction is based on the capture date. The billing amount is divided by the local amount. |
2020.2 |
expenseCode |
String |
Yes, for employee expenses |
The raw expense code NetSuite uses to map to an expense category in NetSuite. You can set an expense code from the Expense Code Mapping subtab on the Format Profile page, or through SuiteScript using the getExpenseCodes(context) interface function. |
2020.2 |
Example
var transaction = account.createNewTransaction({
date: '2019-12-19',
amount: 120.0,
transactionTypeCode: 'P',
uniqueId: '1043423',
id: '243',
payee: 'Oracle Cloud',
currency: 'USD',
memo: 'invoice 123',
transactionStatus: 'Cancelled',
customerReferenceId: '34',
customerName: 'Amit',
invoiceReferenceIds: ['100', '101'],
billedTaxAmount: 15.0,
localChargeAmount: 100.0,
localTaxAmount: 17.0,
currencyExchangeRate: 1.13,
expenseCode: '4'
});