ANS-1195 · SUITESCRIPT DEVELOPMENT
Why Does NetSuite Free-Form Text Field Format Numbers Unexpectedly?
NetSuite custom fields changed from numerical to Free-Form Text may retain old formatting, requiring script values to be explicitly converted to strings.
Short answer
NetSuite custom fields that were initially numerical types (Decimal, Integer, Percent) may retain their formatting behavior even after being reconfigured as Free-Form Text. To prevent this, ensure that any value written to such a field via SuiteScript is explicitly converted to a string using `myVariable.toString()` before setting the field value.
Scenario
Users may encounter an issue in NetSuite where a Free-Form Text custom field unexpectedly formats numerical inputs. This behavior typically occurs when a custom field was initially created with a numerical type (such as Decimal, Integer, or Percent) and subsequently changed to Free-Form Text. The system appears to enforce the field's original numerical formatting, even after its type has been updated.
Solution
To prevent numerical formatting from being applied to a Free-Form Text field, ensure that the value being written to the field via SuiteScript is explicitly a String. If the value is a number, it must be converted to a string using the .toString() method before being set.
For example:
javascript
var myNumber = 6;
// where custrecord_ my_ number is a custom field that was changed from being Integer format to Free-Form Text.
currentRecord.setValue({
fieldId: 'custrecord_ my_ number',
value: myNumber.toString()
});Expert NetSuite Support
Need help with this NetSuite issue?
SuiteScript Development consulting and configuration support
