Skip to main content

Field Types

This reference lists all serverWidget.FieldType enum values available for creating custom forms and Suitelets in SuiteScript 2.x.

Using Field Types

define(['N/ui/serverWidget'], function(serverWidget) {

var form = serverWidget.createForm({
title: 'My Custom Form'
});

var textField = form.addField({
id: 'custpage_name',
type: serverWidget.FieldType.TEXT,
label: 'Name'
});

});

All Field Types

EnumDescriptionCharacter Limit
CHECKBOXCheckbox (Yes/No)-
CURRENCYCurrency field-
DATEDate picker-
DATETIMEDate with time (deprecated, use DATETIMETZ)-
DATETIMETZDate with time and timezone-
EMAILEmail address field-
FILEFile upload (Suitelets only)-
FLOATDecimal number-
HELPHelp text display-
IMAGEImage display-
INLINEHTMLInline HTML content-
INTEGERWhole number-
LABELLabel/static text-
LONGTEXTLong text field100,000 chars
MULTISELECTMulti-select dropdown-
PASSWORDPassword field (masked)-
PERCENTPercentage field-
PHONEPhone number field-
RADIORadio button-
RICHTEXTRich text editor100,000 chars
SELECTSingle-select dropdown-
TEXTSingle-line text300 chars
TEXTAREAMulti-line text area4,000 chars
TIMEOFDAYTime selector-
URLURL field-

Field Type Details

Text Fields

TypeMax CharactersUse Case
TEXT300Short text inputs (names, codes)
TEXTAREA4,000Multi-line descriptions
LONGTEXT100,000Large text content
RICHTEXT100,000Formatted HTML content

Numeric Fields

TypeFormatUse Case
INTEGERWhole numbersQuantities, counts
FLOATDecimal numbersMeasurements, rates
CURRENCYMonetary valuesPrices, amounts
PERCENTPercentageDiscounts, rates

Selection Fields

TypeSelectionUse Case
SELECTSingle choiceDropdowns
MULTISELECTMultiple choicesTag selection
RADIOSingle choice (visible options)Option groups
CHECKBOXYes/NoBoolean flags

Date/Time Fields

TypeFormatNotes
DATEDate onlyStandard date picker
DATETIMETZDate + Time + TimezonePreferred for datetime
TIMEOFDAYTime onlyHour/minute selection
warning

DATETIME is deprecated. Use DATETIMETZ instead when you need both date and time.


Usage Examples

Creating a Form with Multiple Field Types

define(['N/ui/serverWidget'], function(serverWidget) {

function onRequest(context) {
var form = serverWidget.createForm({
title: 'Customer Information'
});

// Text field
form.addField({
id: 'custpage_name',
type: serverWidget.FieldType.TEXT,
label: 'Customer Name'
});

// Email field
form.addField({
id: 'custpage_email',
type: serverWidget.FieldType.EMAIL,
label: 'Email Address'
});

// Select field
var statusField = form.addField({
id: 'custpage_status',
type: serverWidget.FieldType.SELECT,
label: 'Status'
});
statusField.addSelectOption({
value: 'active',
text: 'Active'
});
statusField.addSelectOption({
value: 'inactive',
text: 'Inactive'
});

// Date field
form.addField({
id: 'custpage_startdate',
type: serverWidget.FieldType.DATE,
label: 'Start Date'
});

// Currency field
form.addField({
id: 'custpage_amount',
type: serverWidget.FieldType.CURRENCY,
label: 'Amount'
});

// Checkbox
form.addField({
id: 'custpage_active',
type: serverWidget.FieldType.CHECKBOX,
label: 'Is Active'
});

// Textarea
form.addField({
id: 'custpage_notes',
type: serverWidget.FieldType.TEXTAREA,
label: 'Notes'
});

context.response.writePage(form);
}

return { onRequest: onRequest };
});

Working with Checkbox Values

// Setting checkbox value
record.setValue({
fieldId: 'custpage_active',
value: true // or 'T'
});

// Getting checkbox value
var isActive = record.getValue({
fieldId: 'custpage_active'
});
// Returns: true or false

Adding Select Options Dynamically

var customerField = form.addField({
id: 'custpage_customer',
type: serverWidget.FieldType.SELECT,
label: 'Customer'
});

// Add blank option
customerField.addSelectOption({
value: '',
text: '- Select -'
});

// Add options from search
var customerSearch = search.create({
type: search.Type.CUSTOMER,
columns: ['entityid']
});

customerSearch.run().each(function(result) {
customerField.addSelectOption({
value: result.id,
text: result.getValue('entityid')
});
return true;
});

Restrictions

Sublist Column Restrictions

The following field types are not supported with List.addColumn():

  • CHECKBOX
  • DATETIME
  • DATETIMETZ
  • FILE
  • HELP
  • INLINEHTML
  • LABEL
  • MULTISELECT
  • SELECT
  • RADIO

FILE Field Restrictions

  • Only available for Suitelets
  • Appears on the main tab only
  • Cannot be added to tabs, subtabs, sublists, or field groups
  • Not allowed on existing pages

addField Restrictions

  • DATETIME is not supported - use DATETIMETZ instead

Custom Field Types (SuiteBuilder)

When working with custom fields created in NetSuite UI, you may encounter different field type names:

SuiteBuilder NameSuiteScript Equivalent
Free-Form TextTEXT
Text AreaTEXTAREA
Long TextLONGTEXT
Rich TextRICHTEXT
Check BoxCHECKBOX
DateDATE
Date/TimeDATETIMETZ
CurrencyCURRENCY
Decimal NumberFLOAT
Integer NumberINTEGER
PercentPERCENT
Phone NumberPHONE
Email AddressEMAIL
HyperlinkURL
List/RecordSELECT
Multiple SelectMULTISELECT