Set Decimal Number with Trailing Zeros

When you set a decimal number value in JavaScript, behavior depends on the format of the numeric value. In SuiteScript 2.0, if there are trailing zeros in a decimal value you set, the value is set as a double precision floating point number (double). In SuiteScript 2.1, if there are trailing zeros in a decimal value you set, the value is set as an integer value. Note that in both SuiteScript 2.0 and SuiteScript 2.1, a value is always set as a double value if there are no trailing zeros in the decimal value you specify.

Scenario

SuiteScript 2.0 Behavior

SuiteScript 2.1 Behavior

Set a decimal value with trailing zeros:

                    record.setValue('memo', 616.00) 

                  

record.setValue() saves a number as a double number: 616.0.

record.setValue() saves a number with trailing zeros as an Integer: 616.

Set a decimal value with no trailing zeros:

                    record.setValue('memo', 616.01) 

                  

record.setValue() saves a number as a double number: 616.01.

record.setValue() saves a number as a double number: 616.01.

Related Topics

General Notices