ANS-1578 · ACCOUNTING & FINANCIAL CONFIGURATION
How to Programmatically Identify Voided Journal Entries in NetSuite Scripts?
Understand how to programmatically distinguish voided journal entries from active ones within NetSuite SuiteScripts.
Short answer
Voiding journals are still considered journal transactions and will trigger associated scripts. To programmatically identify a voided journal entry, check the value of its 'void' field. In modern SuiteScript 2.x, this can be done by retrieving the field's boolean value, which will be true if the journal has been voided, allowing scripts to filter accordingly.
Scenario
When custom scripts are deployed to Journal Entry records in NetSuite, they may inadvertently trigger on voided journal entries, leading to unintended processing or errors. Developers need a reliable method to differentiate between active and voided journal entries within their scripts to ensure logic only applies to relevant transactions.
Solution
Voiding journal entries are still recognized as standard journal transactions within NetSuite and will activate any scripts deployed to Journal records. To accurately distinguish a voided journal entry from an active one, developers should inspect the 'void' field on the journal record. In SuiteScript 2.x, this can be achieved by retrieving the value of the 'void' field using Record.getValue or CurrentRecord.getValue. The 'void' field is a checkbox, and its value will be true if the journal entry has been voided, and false otherwise. For example, to check if a journal entry is *not* voided within a script, use the following condition:
javascript
if (!currentRecord.get().getValue({ fieldId: 'void' })) {
// Logic for non-voided journal entries
}This condition evaluates to true when the journal entry is active (not voided), allowing scripts to execute specific logic only for relevant transactions.
Expert NetSuite Support
Need help with this NetSuite issue?
Accounting & Financial Configuration consulting and configuration support
