Field.insertSelectOption(options)
Method Description |
Inserts an option into certain types of select and multiselect fields. This method is usable only in select and multiselect fields that were added by a front-end Suitelet or beforeLoad user event script. The IDs for these fields always have a prefix of custpage. |
Returns |
Void |
Governance |
None |
Supported Script Types |
Client scripts For more information, see SuiteScript 2.x Script Types. |
Module |
|
Since |
2016.2 |
Parameters
The options parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
string |
required |
A string, not visible in the UI, that identifies the option. |
2016.2 |
|
string |
required |
The label that represents the option in the UI. |
2016.2 |
|
boolean |
optional |
Determines whether the option is selected by default. If not specified, this value defaults to false. |
2016.2 |
Errors
Error Code |
Thrown If |
---|---|
|
A script attempts to use this method on the wrong type of field. This method can be used only on select and multiselect fields whose IDs begin with the prefix custpage. |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/currentRecord Module Script Samples.
//Add additional code
...
// Instantiate the field. Note that this method is supported only
// on fields whose fieldIds have a prefix of custpage.
var field = call.getField({
fieldId: 'custpage_select1field'
});
// Insert a new option.
field.insertSelectOption({
value: 'Option1',
text: 'alpha'
});
...
//Add additional code