ANS-0507 · CUSTOM FIELDS, RECORDS & FORMS
How to Insert a Line Break in NetSuite Text Fields?
Learn how to add line breaks in NetSuite text fields using SQL text formulas for server-side processing, UI display, or client-side JavaScript.
Short answer
To insert a line break in NetSuite text fields, use CHAR(10) in SQL text formulas for server-side processing, or '<br/>' for UI display in search results. For client-side JavaScript, concatenate strings with 'n'.
Scenario
Users often need to display information across multiple lines within a single text field in NetSuite. This requirement arises in various contexts, such as custom fields, search results, or when dynamically setting field values, where standard text input does not automatically support line breaks.
Solution
To insert a line break in NetSuite text fields, different methods apply depending on whether the operation is server-side via SQL text formulas, for display in search results, or client-side using JavaScript.
For Server-Side SQL Text Formulas:When processing text formulas server-side, the Oracle SQL engine interprets CHAR(10) as a line break.
{field_1} || CHAR(10) || {field_2}This will insert a line break between the values of field_1 and field_2 in the underlying data.
For UI Display in Search Results:If the goal is to display a line break within the results of a SQL text formula directly in the NetSuite UI (e.g., in search results), use the HTML
tag.
{field_1} || '<br/>' || {field_2}The UI will render this HTML tag as a visual line break.
For Client-Side JavaScript:When setting field values using client-side JavaScript, the standard newline character 'n' is used to insert a line break.
nlapiSetFieldValue('textfield', 'blablabla' + 'n' + 'sploush')This will set the value of the 'textfield' with a line break.
Expert NetSuite Support
Need help with this NetSuite issue?
Custom Fields, Records & Forms consulting and configuration support
