transaction.void(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

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.

  • If a direct void is performed, returns the ID of the record voided.

  • If a void by reversing journal is performed, returns the ID of the newly created voiding journal.

Supported Script Types

Client and server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

10 units

Module

N/transaction Module

Since

2015.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.id

number | string

required

Internal ID of the specific transaction record instance to void.

2015.2

options.type

string

required

Internal ID of the type of transaction record to void

2015.2

Errors

Error Code

Message

Thrown If

INVALID_RECORD_TYPE

The type argument passed is not valid or the record type is not voidable.

THAT_RECORD_DOES_NOT_EXIST

The id argument passed is not valid.

SSS_MISSING_REQD_ARGUMENT

The type or id argument is missing.

Syntax
Important:

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 

        

Related Topics

N/transaction Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices