N/ui/serverWidget Module

Use the N/ui/serverWidget module to work with the user interface within NetSuite. You can use Suitelets to build custom pages and wizards that have a NetSuite look-and-feel. You can also create various components of the NetSuite UI (for example, forms, fields, sublists, tabs).

Important:

SuiteScript does not support direct access to the NetSuite UI through the Document Object Model (DOM). The NetSuite UI should only be accessed using SuiteScript APIs.

Important:

When you add a UI object to an existing NetSuite page, to minimize the occurrence of field/object name conflicts, the internal ID that references the object must be prefixed with custpage.

                                   

In This Help Topic

N/ui/serverWidget Module Members

Member Type

Name

Return Type / Value Type

Supported Script Types

Description

Object

serverWidget.Assistant

Object

Suitelets

A scriptable, multi-step NetSuite assistant.

serverWidget.AssistantStep

Object

Suitelets

A step within a custom NetSuite assistant.

serverWidget.Button

Object

Suitelets and beforeLoad user events

A button that appears in a UI object.

serverWidget.Field

Object

Suitelets and beforeLoad user events

A NetSuite field.

serverWidget.FieldGroup

Object

Suitelets and beforeLoad user events

A field group.

serverWidget.Form

Object

Suitelets and beforeLoad user events

A NetSuite form.

serverWidget.List

Object

Suitelets

A list.

serverWidget.ListColumn

Object

Suitelets

A list column.

serverWidget.Sublist

Object

Suitelets and beforeLoad user events

A NetSuite sublist.

serverWidget.Tab

Object

Suitelets and beforeLoad user events

A NetSuite tab and subtabs.

Method

serverWidget.createAssistant(options)

serverWidget.Assistant

Suitelets

Creates and returns a new assistant object.

serverWidget.createForm(options)

serverWidget.Form

Suitelets

Creates and returns a new form object.

serverWidget.createList(options)

serverWidget.List

Suitelets

Creates a List object (specifying the title, and whether to hide the navigation bar).

Enum

serverWidget.AssistantSubmitAction

string (read-only)

Suitelets

Holds the string values for submit actions performed by the user.

serverWidget.FieldBreakType

string (read-only)

Suitelets and beforeLoad user events

Holds the string values for supported field break types. This enum is used to set the value of the Field.updateBreakType(options) property.

serverWidget.FieldDisplayType

string (read-only)

Suitelets and beforeLoad user events

Holds the string values for supported field display types. This enum is used to set the value of the Field.updateDisplayType(options) property.

serverWidget.FieldLayoutType

string (read-only)

Suitelets and beforeLoad user events

Holds the string values for the supported types of field layouts. This enum is used to set the value of the Field.updateLayoutType(options) property.

serverWidget.FieldType

string (read-only)

Suitelets and beforeLoad user events

Holds the values for supported field types. This enum is used to set the value of the Field.type property.

serverWidget.FormPageLinkType

string (read-only)

Suitelets and beforeLoad user events

Holds the string values for supported page link types on a form. This enum is used to set the value of the type parameter for Form.addPageLink(options).

serverWidget.LayoutJustification

string (read-only)

Suitelets and beforeLoad user events

Holds the string values for supported justification layouts. This enum is used to set the value of the align parameter when List.addColumn(options) is called.

serverWidget.ListStyle

string (read-only)

Suitelets

Holds the string values for supported list styles. This enum is used to set the value of the List.style property.

serverWidget.SublistDisplayType

string (read-only)

Suitelets and beforeLoad user events

Holds the string values for supported sublist display types. This enum is used to set the value of the Sublist.displayType property.

serverWidget.SublistType

string (read-only)

Suitelets and beforeLoad user events

Holds the string values for valid sublist types. This enum is used to define the type parameter when Form.addSublist(options) is called.

Assistant Object Members

The following members are called on the serverWidget.Assistant object.

Member Type

Name

Return Type / Value Type

Supported Script Types

Description

Method

Assistant.addField(options)

serverWidget.Field

Suitelets

Adds a field to an assistant.

Assistant.addFieldGroup(options)

serverWidget.FieldGroup

Suitelets

Adds a field group to an assistant.

Assistant.addStep(options)

serverWidget.AssistantStep

Suitelets

Adds a step to an assistant.

Assistant.addSublist(options)

serverWidget.Sublist

Suitelets

Adds a sublist to an assistant.

Assistant.getField(options)

serverWidget.Field

Suitelets

Gets a field object.

Assistant.getFieldGroup(options)

serverWidget.FieldGroup

Suitelets

Gets a field group object.

Assistant.getFieldGroupIds()

string[]

Suitelets

Gets all the field group IDs in an assistant.

Assistant.getFieldIds()

string[]

Suitelets

Gets all the field IDs in an assistant.

Assistant.getFieldIdsByFieldGroup(fieldGroup)

string[]

Suitelets

Gets all field IDs in the assistant field group.

Assistant.getLastAction()

string

Suitelets

Gets the last action submitted by the user.

Assistant.getLastStep()

serverWidget.AssistantStep

Suitelets

Gets the step that the last submitted action came from.

Assistant.getNextStep()

serverWidget.AssistantStep

Suitelets

Gets the next step prompted by the assistant.

Assistant.getStep(options)

serverWidget.AssistantStep

Suitelets

Returns a step in an assistant.

Assistant.getStepCount()

number

Suitelets

Gets the total count of steps in the assistant.

Assistant.getSteps()

serverWidget.AssistantStep[]

Suitelets

Gets all the steps in the assistant.

Assistant.getSublist(options)

serverWidget.Sublist

Suitelets

Get a Sublist object from its ID.

Assistant.getSublistIds()

string[]

Suitelets

Gets all the sublist IDs in an assistant.

Assistant.hasErrorHtml()

Boolean

Suitelets

Indicates whether the assistant has an error message to display.

Assistant.isFinished()

Boolean

Suitelets

Indicates the status of the assistant. If set to true, the assistant is finished.

Assistant.sendRedirect(options)

void

Suitelets

Manages redirects in an assistant.

Assistant.setSplash(options)

void

Suitelets

Define a splash message.

Assistant.updateDefaultValues(values)

void

Suitelets

Sets the default values of an array of fields that are specific to the assistant.

Property

Assistant.clientScriptFileId

number

Suitelets

The File Cabinet ID of client script file to be used in this assistant.

Assistant.clientScriptModulePath

string

Suitelets

The relative path to the client script file to be used in this assistant.

Assistant.currentStep

serverWidget.AssistantStep (read-only)

Suitelets

The current step.

Assistant.errorHtml

string

Suitelets

The error message text.

Assistant.finishedHtml

string

Suitelets

The text displayed after an assistant is finished.

Assistant.hideAddToShortcutsLink

Boolean

Suitelets

Whether the Add to Shortcuts Link is displayed in the UI.

Assistant.hideStepNumber

Boolean

Suitelets

Whether the current and total step numbers are displayed in the UI.

Assistant.isNotOrdered

Boolean

Suitelets

Whether assistant steps are ordered or unordered.

Assistant.title

string

Suitelets

The title of the assistant.

AssistantStep Object Members

The following members are called on the serverWidget.AssistantStep object.

Member Type

Name

Return Type / Value Type

Supported Script Types

Description

Method

AssistantStep.getFieldIds()

string[]

Suitelets

Gets all the field IDs in an assistant step.

AssistantStep.getLineCount(options)

number

Suitelets

Gets the number of lines previously entered by a user in a step.

AssistantStep.getLineCount(options)

string[]

Suitelets

Gets all the field IDs in a list.

AssistantStep.getSublistValue(options)

string

Suitelets

Gets the current value of a sublist field (line item) in a step.

AssistantStep.getSubmittedSublistIds()

string[]

Suitelets

Gets the IDs for all the sublist fields (line items) in a step.

AssistantStep.getValue(options)

string | string[]

Suitelets

Gets the current value of a field.

Property

AssistantStep.helpText

string

Suitelets

The help text for a step.

AssistantStep.id

string (read-only)

Suitelets

The internal ID of the step.

AssistantStep.label

string

Suitelets

The label for a step.

AssistantStep.stepNumber

number

Suitelets

Indicates where this step appears sequentially in an assistant.

Button Object Members

The following members are called on the serverWidget.Button object.

Member Type

Name

Property Type

Supported Script Types

Description

Property

Button.isDisabled

Boolean

Suitelets and beforeLoad user events

Whether a button is grayed-out and disabled.

Button.isHidden

Boolean

Suitelets and beforeLoad user events

Whether the button is hidden in the UI.

Button.label

string

Suitelets and beforeLoad user events

The label for the button.

Field Object Members

The following members are called on the serverWidget.Field object.

Member Type

Name

Return Type / Value Type

Supported Script Types

Description

Method

Field.addSelectOption(options)

void

Suitelets and beforeLoad user events

Adds a select option to a dropdown list for a selectable field.

Field.getSelectOptions(options)

Object[]

Suitelets and beforeLoad user events

Returns the internal ID and label of the options for a select field as name/value pairs.

Field.setHelpText(options)

serverWidget.Field

Suitelets and beforeLoad user events

Sets the help text that appears in the field help popup.

Field.updateBreakType(options)

serverWidget.Field

Suitelets and beforeLoad user events

Updates the break type used to add a break in flow layout for the field.

Field.updateDisplaySize(options)

serverWidget.Field

Suitelets and beforeLoad user events

Updates the height and width for the field.

Field.updateDisplayType(options)

serverWidget.Field

Suitelets and beforeLoad user events

Updates the type of display for the field.

Field.updateLayoutType(options)

serverWidget.Field

Suitelets and beforeLoad user events

Updates the layout type for the field.

Property

Field.alias

string

Suitelets and beforeLoad user events

The alias used to set the field value.

Field.defaultValue

string

Suitelets and beforeLoad user events

The default value for the field.

Field.helpText

string (read-only)

Suitelets and beforeLoad user events

The help text for the field.

Field.id

string (read-only)

Suitelets and beforeLoad user events

The internal ID for the field.

Field.isMandatory

Boolean

Suitelets and beforeLoad user events

Whether the field is required.

Field.label

string

Suitelets and beforeLoad user events

The label for the field.

Field.linkText

string

Suitelets and beforeLoad user events

The text displayed for a link in place of the URL.

Field.maxLength

number

Suitelets and beforeLoad user events

The maximum length, in characters, for the field.

Field.padding

number

Suitelets and beforeLoad user events

The number of empty vertical character spaces above the field.

Field.richTextHeight

number

Suitelets and beforeLoad user events

The height of a rich text field, in pixels.

Field.richTextWidth

number

Suitelets and beforeLoad user events

The width of a rich text field, in pixels.

Field.type

string (read-only)

Suitelets and beforeLoad user events

The type of field.

FieldGroup Object Members

The following members are called on the serverWidget.FieldGroup object.

Member Type

Name

Property Type

Supported Script Types

Description

Property

FieldGroup.isBorderHidden

Boolean

Suitelets and beforeLoad user events

Whether a border appears around the field group.

FieldGroup.isCollapsible

Boolean

Suitelets and beforeLoad user events

Whether the field group is collapsible.

FieldGroup.isCollapsed

Boolean

Suitelets and beforeLoad user events

Whether the field group is initially collapsed or expanded in the default view.

FieldGroup.isSingleColumn

Boolean

Suitelets and beforeLoad user events

Whether the field group is displayed in a single column.

FieldGroup.label

string

Suitelets and beforeLoad user events

The label for the field group.

Form Object Members

The following members are called on the serverWidget.Form object.

Member Type

Name

Return Type / Value Type

Supported Script Types

Description

Method

Form.addButton(options)

serverWidget.Button

Suitelets and beforeLoad user events

Adds a button to the form.

Form.addCredentialField(options)

serverWidget.Field

Suitelets and beforeLoad user events

Adds a field that store credentials in NetSuite for invoking services provided by third parties.

Form.addField(options)

serverWidget.Field

Suitelets and beforeLoad user events

Adds a field to the form.

Form.addFieldGroup(options)

serverWidget.FieldGroup

Suitelets and beforeLoad user events

Adds a group of fields to the form.

Form.addPageInitMessage(options)

void

Suitelets and beforeLoad user events

Shows a message on a form in view mode. You can use this method to show a message on a form based on its user event script context.

Form.addPageLink(options)

void

Suitelets and beforeLoad user events

Adds a link to a form.

Form.addResetButton(options)

serverWidget.Button

Suitelets and beforeLoad user events

Adds a Reset button to a form that clears the values of all fields.

Form.addSecretKeyField(options)

serverWidget.Field

Suitelets and beforeLoad user events

Add a secret key field to the form.

Form.addSublist(options)

serverWidget.Sublist

Suitelets and beforeLoad user events

Adds a sublist to the form.

Form.addSubmitButton(options)

serverWidget.Button

Suitelets and beforeLoad user events

Adds a submit button to a form that saves user inputs.

Form.addSubtab(options)

serverWidget.Tab

Suitelets and beforeLoad user events

Adds a subtab to a form.

Form.addTab(options)

serverWidget.Tab

Suitelets and beforeLoad user events

Adds a tab to a form.

Form.getButton(options)

serverWidget.Button

Suitelets and beforeLoad user events

Returns a button by internal ID.

Form.getField(options)

serverWidget.Field

Suitelets and beforeLoad user events

Returns a field by internal ID.

Form.getSublist(options)

serverWidget.Sublist

Suitelets and beforeLoad user events

Returns a sublist by internal ID.

Form.getSubtab(options)

serverWidget.Tab

Suitelets and beforeLoad user events

Returns a subtab by internal ID.

Form.getTab(options)

serverWidget.Tab

Suitelets and beforeLoad user events

Returns a tab object from its internal ID.

Form.getTabs()

string[]

Suitelets and beforeLoad user events

Returns the internal IDs of all tabs.

Form.insertField(options)

void

Suitelets and beforeLoad user events

Inserts a field before another field within a form.

Form.insertSublist(options)

void

Suitelets and beforeLoad user events

Inserts a sublist before another sublist on a form.

Form.insertSubtab(options)

void

Suitelets and beforeLoad user events

Inserts a subtab before another subtab on a form.

Form.insertTab(options)

void

Suitelets and beforeLoad user events

Inserts a tab before another tab on a form.

Form.removeButton(options)

void

Suitelets and beforeLoad user events

Removes a button from a form.

Form.updateDefaultValues(options)

void

Suitelets and beforeLoad user events

Sets the default values of many fields on a form.

Property

Form.clientScriptFileId

number

Suitelets and beforeLoad user events

The File Cabinet ID of client script file to be used in this form.

Form.clientScriptModulePath

string

Suitelets and beforeLoad user events

The relative path to the client script file to be used in this form.

Form.title

string

Suitelets and beforeLoad user events

The title used for the form.

List Object Members

The following members are called on the serverWidget.List object.

Member Type

Name

Return Type / Value Type

Supported Script Types

Description

Method

List.addButton(options)

serverWidget.Button

Suitelets

Adds a button to a list.

List.addColumn(options)

serverWidget.ListColumn

Suitelets

Adds a column to a list.

List.addEditColumn(options)

serverWidget.ListColumn

Suitelets

Adds a column containing Edit or Edit/View links to a Suitelet or Portlet list.

List.addPageLink(options)

serverWidget.List

Suitelets

Adds a link to a list.

List.addRow(options)

serverWidget.List

Suitelets

Adds a single row to a list.

List.addRows(options)

serverWidget.List

Suitelets

Adds multiple rows to a list.

Property

List.clientScriptFileId

number

Suitelets

The File Cabinet ID of client script file to be used in this list.

List.clientScriptModulePath

string

Suitelets

The relative path to the client script file to be used in this list.

List.style

string

Suitelets

The display style for this list.

List.title

string

Suitelets

The List title.

ListColumn Object Members

The following members are called on the serverWidget.ListColumn object.

Member Type

Name

Return Type / Value Type

Supported Script Types

Description

Method

ListColumn.addParamToURL(options)

serverWidget.ListColumn

Suitelets

Adds a URL parameter (optionally defined per row) to the list column's URL.

ListColumn.setURL(options)

serverWidget.ListColumn

Suitelets

Sets the base URL for the list column.

Property

ListColumn.label

string

Suitelets

The label of this list column.

Sublist Object Members

The following members are called on the serverWidget.Sublist object.

Member Type

Name

Return Type / Value Type

Supported Script Types

Description

Method

Sublist.addButton(options)

serverWidget.Button

Suitelets and beforeLoad user events

Adds a button to a sublist.

Sublist.addField(options)

serverWidget.Field

Suitelets and beforeLoad user events

Add a field to a sublist.

Sublist.addMarkAllButtons()

serverWidget.Button[]

Suitelets and beforeLoad user events

Adds a Mark All or Unmark All button.

Sublist.addRefreshButton()

serverWidget.Button

Suitelets and beforeLoad user events

Adds a Reset button.

Sublist.getField(options)

serverWidget.Field

Suitelets and beforeLoad user events

Returns a Field object on a specified sublist.

Sublist.getSublistValue(options)

string

Suitelets and beforeLoad user events

Gets a field value on a sublist.

Sublist.setSublistValue(options)

void

Suitelets and beforeLoad user events

Sets the value of a sublist field.

Sublist.updateTotallingFieldId(options)

serverWidget.Sublist

Suitelets and beforeLoad user events

Updates the ID of a field designated as a totalling column, which is used to calculate and display a running total for the sublist.

Sublist.updateUniqueFieldId(options)

serverWidget.Sublist

Suitelets and beforeLoad user events

Updates a field ID that is to have unique values across the rows in the sublist.

Property

Sublist.displayType

string

Suitelets and beforeLoad user events

The display style for a sublist.

Sublist.helpText

string

Suitelets and beforeLoad user events

The inline help text for a sublist.

Sublist.label

string

Suitelets and beforeLoad user events

The label for a sublist.

Sublist.lineCount

number (read-only)

Suitelets and beforeLoad user events

The number of line items in a sublist.

Tab Object Members

The following members are called on the serverWidget.Tab object.

Member Type

Name

Value Type

Supported Script Types

Description

Property

Tab.helpText

string

Suitelets and beforeLoad user events

The inline help text for a tab or subtab.

Tab.label

string

Suitelets and beforeLoad user events

The label for a tab or subtab.

Related Topics

General Notices