Portlet.addField(options)
Method Description |
Adds a field to the form. |
Returns |
|
Entry Point |
|
Since |
2016.2 |
Parameters
The options parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
string |
required |
The internal ID of the field. Keep the internal ID in lowercase, space-free, and prefix it with custpage if you're adding it 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 |
2016.2 |
|
string |
required |
The label for this field. |
2016.2 |
|
string |
required |
The field type for the field. For more information about possible values, see serverWidget.FieldType. |
2016.2 |
|
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, the source parameter needs to include the field's internal ID.
Important:
Once you've created a select or multi-select field from a record or list, you can't add more values using 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. Note that this isn't a working 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'
});
...