ANS-1396 · SUITESCRIPT DEVELOPMENT

How to Resolve Rounding Discrepancies When Scripting NetSuite Payments?

Resolve rounding discrepancies in NetSuite transaction amounts due to SuiteScript record loading modes.

Short answer

Rounding issues during script-based transaction processing in NetSuite often stem from using dynamic mode when loading records. To prevent NetSuite from recalculating amounts and introducing precision errors, load the record in static (standard) mode. This ensures the exact values are preserved, resolving application errors.

Scenario

A user is scripting a transaction payment where the total amount is precisely 0.15 (derived from 0.05 + 0.10). While the NetSuite user interface correctly displays the amount owed as 0.15, submitting the payment via script results in an error: '0.1500000002 cannot be applied'. Debugging confirms both the script's calculated value and the UI's invoice due amount are exactly 0.15, pointing to a discrepancy introduced during script processing.

Solution

When processing transactions via SuiteScript, using record.load in dynamic mode can lead to NetSuite recalculating transaction amounts, potentially introducing minor precision errors. To prevent these recalculations and ensure exact values are maintained, records should be loaded in static (standard) mode. This approach resolves issues where script-submitted amounts differ infinitesimally from expected values, such as '0.1500000002 cannot be applied'. To load a record in static mode using SuiteScript 2.x, set the isDynamic option to false when calling record.load.

javascript
var recordId = 123; // Replace with actual record ID
var recordType = record.Type.VENDOR_PAYMENT; // Replace with actual record type
var paymentRecord = record.load({
    type: recordType,
    id: recordId,
    isDynamic: false // Load in static (standard) mode
});

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant