ANS-1411 · SUITESCRIPT DEVELOPMENT

How to Set Percentage Discounts on Sales Order Lines in SuiteScript 2.0?

Efficiently apply percentage discounts to NetSuite Sales Order lines using SuiteScript 2.0.

Short answer

The field `rate` is not used for percentage discounts. Instead, use the `discountrate` field, which is documented in the NetSuite Records Browser for SalesOrder and Invoice records, to set negative percentage values for line-level discounts.

Scenario

Users attempting to apply percentage-based discounts to individual line items on a Sales Order in SuiteScript 2.0 often encounter issues when trying to set the line-level `rate` field with percentage values, leading to an `INVALID_FLD_VALUE` error.

Solution

The rate field is not where percentage discounts are directly applied on Sales Order lines. Instead, use the discountrate field to set negative percentage values for line-level discounts. This field is documented in the NetSuite Records Browser for SalesOrder and Invoice records.

Alternatively, calculate the flat monetary value that the percentage discount represents and set the rate field with this calculated value.

While the discountrate field is now documented, it is always recommended to perform thorough testing of any script modifications, especially those impacting financial calculations.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant