Field.getSelectOptions(options)
Method Description |
Obtains an array of available options on a dropdown select, multi-select, or radio field. The internal ID and label of the field options are returned as name/value pairs. |
Returns |
Object[] This function returns an array in the following format:
This function returns If you attempt to get select options on a field that is not a dropdown select field, such as a popup select field or a field that does not exist on the form, Because the maximum value for the Maximum Entries in Dropdowns settings is 500, the maximum number of options that can be returned by this method is 500.
Note:
A call to this method may return different results for the same field for different roles. |
Supported Script Types |
Suitelets User event scripts -beforeLoad entry point For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Since |
2015.2 |
Parameters
The options parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
string |
optional |
A search string to filter the select options that are returned. For example, if there are 50 select options available, and 10 of the options contains 'John', for example, “John Smith” or “Shauna Johnson”, only those 10 options will be returned. Filter values are case insensitive. The filters 'John' and 'john' will return the same select options. |
2015.2 |
|
string |
optional |
Supported operators are If not specified, defaults to the |
2015.2 |
Syntax
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 form = serverWidget.createForm({
title : 'Simple Form'
});
var selectField = form.addField({
id : 'custpage_selectfield',
type : serverWidget.FieldType.SELECT,
label : 'Select'
});
selectField.addSelectOption({
value : 'a',
text : 'Albert'
});
var options = field.getSelectOptions({
filter : 'a',
filteroperator: 'startswith'
});
...
//Add additional code