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
| Enum | Description | Character Limit |
|---|---|---|
CHECKBOX | Checkbox (Yes/No) | - |
CURRENCY | Currency field | - |
DATE | Date picker | - |
DATETIME | Date with time (deprecated, use DATETIMETZ) | - |
DATETIMETZ | Date with time and timezone | - |
EMAIL | Email address field | - |
FILE | File upload (Suitelets only) | - |
FLOAT | Decimal number | - |
HELP | Help text display | - |
IMAGE | Image display | - |
INLINEHTML | Inline HTML content | - |
INTEGER | Whole number | - |
LABEL | Label/static text | - |
LONGTEXT | Long text field | 100,000 chars |
MULTISELECT | Multi-select dropdown | - |
PASSWORD | Password field (masked) | - |
PERCENT | Percentage field | - |
PHONE | Phone number field | - |
RADIO | Radio button | - |
RICHTEXT | Rich text editor | 100,000 chars |
SELECT | Single-select dropdown | - |
TEXT | Single-line text | 300 chars |
TEXTAREA | Multi-line text area | 4,000 chars |
TIMEOFDAY | Time selector | - |
URL | URL field | - |
Field Type Details
Text Fields
| Type | Max Characters | Use Case |
|---|---|---|
TEXT | 300 | Short text inputs (names, codes) |
TEXTAREA | 4,000 | Multi-line descriptions |
LONGTEXT | 100,000 | Large text content |
RICHTEXT | 100,000 | Formatted HTML content |
Numeric Fields
| Type | Format | Use Case |
|---|---|---|
INTEGER | Whole numbers | Quantities, counts |
FLOAT | Decimal numbers | Measurements, rates |
CURRENCY | Monetary values | Prices, amounts |
PERCENT | Percentage | Discounts, rates |
Selection Fields
| Type | Selection | Use Case |
|---|---|---|
SELECT | Single choice | Dropdowns |
MULTISELECT | Multiple choices | Tag selection |
RADIO | Single choice (visible options) | Option groups |
CHECKBOX | Yes/No | Boolean flags |
Date/Time Fields
| Type | Format | Notes |
|---|---|---|
DATE | Date only | Standard date picker |
DATETIMETZ | Date + Time + Timezone | Preferred for datetime |
TIMEOFDAY | Time only | Hour/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
DATETIMEis not supported - useDATETIMETZinstead
Custom Field Types (SuiteBuilder)
When working with custom fields created in NetSuite UI, you may encounter different field type names:
| SuiteBuilder Name | SuiteScript Equivalent |
|---|---|
| Free-Form Text | TEXT |
| Text Area | TEXTAREA |
| Long Text | LONGTEXT |
| Rich Text | RICHTEXT |
| Check Box | CHECKBOX |
| Date | DATE |
| Date/Time | DATETIMETZ |
| Currency | CURRENCY |
| Decimal Number | FLOAT |
| Integer Number | INTEGER |
| Percent | PERCENT |
| Phone Number | PHONE |
| Email Address | |
| Hyperlink | URL |
| List/Record | SELECT |
| Multiple Select | MULTISELECT |