Portlet.addField(options)

Method Description

Adds a field to the form.

Returns

serverWidget.Field

Entry Point

render(params)

Since

2016.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.id

string

required

The internal ID of the field.

The internal ID must be in lowercase, contain no spaces, and include the prefix custpage if you are adding the field to an existing page. For example, if you add a field that appears as Purchase Details, the field internal ID should be something similar to custpage_purchasedetails or custpage_purchase_details.

2016.2

options.label

string

required

The label for this field.

2016.2

options.type

string

required

The field type for the field.

For more information about possible values, see serverWidget.FieldType.

2016.2

options.source

string

optional

The internal ID or script ID of the source list for this field if it is a select (List/Record) or multi-select field.

Note:

For radio fields only, the source parameter must contain the internal ID for the field.

Important:

After you create a select or multi-select field that is sourced from a record or list, you cannot add additional values with Field.addSelectOption(options). The select values are determined by the source record or list.

2016.2

Syntax

The following code snippet shows the syntax for this member. It is not a functional example. For a complete script example, see SuiteScript 2.x Portlet Script Type.

          ...
var newField = params.portlet.addField({ id: 'textfield', type: serverWidget.FieldType.TEXT, label: 'text'
});
... 

        

Related Topics

Portlet Object
Portlet.addColumn(options)
Portlet.addEditColumn(options)
Portlet.addLine(options)
Portlet.addRow(options)
Portlet.addRows(options)
Portlet.setSubmitButton(options)
Portlet.clientScriptFileId
Portlet.clientScriptModulePath
Portlet.html
Portlet.title

General Notices