Assistant.addField(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Adds a field to an assistant. Use fields to record or display information specific to your needs.

Returns

serverWidget.Field object

Supported Script Types

SuiteScript 2.x Suitelet Script Type

Governance

None

Module

N/ui/serverWidget Module

Since

2015.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.id

string

required

The internal ID for this field.

2015.2

options.label

string

required

The label for this field.

2015.2

options.type

string

required

The field type. Use the serverWidget.FieldType enum to set this value.

Note:

If you have set the type parameter to SELECT or MULTISELECT, and you want to add custom options to the select field, you must set source to NULL. Then, when a value is specified, the value will populate the options from the source.

Important:

Long text fields created with SuiteScript have a character limit of 100,000. Long text fields created with Suitebuilder have a character limit of 1,000,000.

2015.2

options.source

string

optional

The internalId or scriptId of the source list for this field. Use this parameter if you are adding a select (List/Record) or multi-select type of field.

For radio fields only, the source parameter is not an optional parameter, it must contain the radio button's unique internal ID. The id parameter contains the ID that identifies all the radio buttons of the same group.

Note:

If you want to add custom options on a select or multi-select field, you must set the source parameter to NULL , and then add the custom options using Field.addSelectOption(options).

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.

2015.2

options.container

string

optional

The internal ID of the field group to place this field in.

2016.1

Syntax
Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/ui/serverWidget Module Script Samples.

          //Add additional code 
...
var assistant = serverWidget.createAssistant({
    title : 'Simple Assistant'
});
assistant.addField({
    id : 'idname',
    type : serverWidget.FieldType.TEXT,
    label : 'Sample label'
});
...
//Add additional code 

        

Related Topics

serverWidget.Assistant
N/ui/serverWidget Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices