Field.getSelectOptions(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

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.

Important:

You can use this method only in dynamic mode. For additional information about dynamic mode, see CurrentRecord.isDynamic.

Returns

array

This function returns an array in the following format:

                    [{value: 5, text: 'abc'},{value: 6, text: '123'}] 

                  

This function returns Type Error if the field is not a supported field for this method.

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, null is returned. For example, if the number of options available for the field is greater than your setting for Maximum Entries in Dropdowns at Home > Set Preferences, the field becomes a popup field, and this method returns null.

Because the maximum value for the Maximum Entries in Dropdowns settings is 500, the maximum number of options that can be returned is 500.

Note:

A call to this method may return different results for the same field for different roles.

Governance

None

Supported Script Types

Client scripts

For more information, see SuiteScript 2.x Client Script Type.

Module

N/currentRecord Module

Since

2016.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.filter

string

Required

The search string to filter the select options that are returned.

Note:

Filter values are case insensitive.

2016.2

options.operator

string

Required

The following operators are supported:

  • contains (default)

  • is

  • startswith

2016.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/currentRecord Module Script Samples.

          //Add additional code 
...
var options = objField.getSelectOptions({
    filter : 'C',
    operator : 'startswith'
});
...
//Add additional code 

        

Related Topics

currentRecord.Field
N/currentRecord Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices