transaction.void(options)
Method Description |
Voids a transaction record object and return an id that indicates the type of void performed. The type of void performed depends on the targeted account’s preference settings.
Important:
After you void a transaction, you cannot make changes to the transaction that impact the general ledger. |
Returns |
An ID returned as a number.
|
Supported Script Types |
Client and server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
10 units |
Module |
|
Since |
2015.2 |
Parameters
The options parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
number | string |
required |
Internal ID of the specific transaction record instance to void. |
2015.2 |
|
string |
required |
Internal ID of the type of transaction record to void |
2015.2 |
Errors
Error Code |
Message |
Thrown If |
---|---|---|
INVALID_RECORD_TYPE |
— |
The |
THAT_RECORD_DOES_NOT_EXIST |
— |
The |
SSS_MISSING_REQD_ARGUMENT |
— |
The |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/transaction Module Script Sample.
In the code sample below, a sales order is voided. You must disable the Void Transactions Using Reversing Journals feature in your NetSuite account by navigating to Setup > Accounting > Preferences > Accounting Preferences to avoid an error being thrown. To see which transactions support this feature, refer to the chart in transaction.Type. For more information about voiding transactions, see Voiding, Deleting, or Closing Transactions.
//Add additional code
...
var voidSalesOrderId = transaction.void({
type: transaction.Type.SALES_ORDER, //disable Void Transactions Using Reversing Journals in Account Pref
id: salesOrderId
});
...
//Add additional code