Sublist.addField(options)

Method Description

Adds a field to a sublist.

Returns

serverWidget.Field object

Supported Script Types

Suitelets

User event scripts -beforeLoad entry point

For more information, see SuiteScript 2.x Script Types.

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.

The internal ID must be in lowercase and without spaces.

2015.2

options.label

string

required

The UI label for this field.

2015.2

options.type

string

required

The field type.

Use the serverWidget.FieldType enum to set this value. The DATETIME, FILE, HELP, INLINEHTML, LABEL, LONGTEXT, MULTISELECT, RADIO and RICHTEXT values are not supported with this method.

Note:

If you have set the type parameter to SELECT, and you want to add custom options to the select field, you must set source to NULL.

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) type of field.

Note:

If you want to add custom options on a select field, you must set the source parameter to NULL.

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 tab or field group to add the field to.

Use this parameter to specify either a tab or a field group to place the field in.

By default, the field is added to the main section of the form.

2015.2

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 
/** 
 * @NApiVersion 2.x
 * @NScriptType suitelet
 */
define(['N/ui/serverWidget'], function(serverWidget) {
    return Object.freeze({
        onRequest: function(context) {
            var form = serverWidget.createForm({
                title: 'Simple Form'
            });
            var sublist = form.addSublist({
                id: 'sublist',
                type: serverWidget.SublistType.INLINEEDITOR,
                label: 'Inline Editor Sublist'
            });
            sublist.addField({
                id: 'fieldid',
                type: serverWidget.FieldType.DATE,
                label: 'Date'
            });
            context.response.writePage(form);
        }

    });
}); //Add additional code 

        

Related Topics

General Notices