Void a transaction in NetSuite

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

Governance

10 units

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.

//Add additional code
...
var voidSalesOrderId = transaction.void({
    type: transaction.Type.SALES_ORDER, //disable Void Transactions Using Reversing Journals in Account Pref
    id: salesOrderId
});

Leave a comment

Your email address will not be published. Required fields are marked *